如何使用FONT AWACYICON图标与扩展 /合同进行反应表V7?
我正在尝试使用React-Table及其扩展/合同功能,但无法弄清楚如何替换文档中给出的图标。我正在尝试使用字体引人入胜的图标,但是即使使用DangernlySetinnerhtml,我也会得到一个字符串,而不是图标。这是文档中的示例: https://reactt-tps://react-tpable.tanstack。 com/docs/示例/sub-components
这是相关的块。我可以添加一个简单的字符串来替换手指,'>'和'^',但需要使用跨度图标(font很棒):
{
// Make an expander cell
Header: () => null, // No header
id: 'expander', // It needs an ID
Cell: ({ row }) => (
// Use Cell to render an expander for each row.
// We can use the getToggleRowExpandedProps prop-getter
// to build the expander.
<span {...row.getToggleRowExpandedProps()}>
{row.isExpanded ? '
I'm attempting to use react-table and its expand/contract functionality, but can't figure out how to replace the icon given in the documentation. I'm trying to use a font-awesome icon, but even with dangerouslySetInnerHTML I get a string, instead of the icon. Here is the example in the documentation: https://react-table.tanstack.com/docs/examples/sub-components
Here is the codesandbox: https://codesandbox.io/s/github/tannerlinsley/react-table/tree/v7/examples/sub-components?file=/src/App.js:3192-3633
This is the block in question. I can add a simple string to replace the fingers, by '>' and '^' but need to use a span icon (font awesome):
{
// Make an expander cell
Header: () => null, // No header
id: 'expander', // It needs an ID
Cell: ({ row }) => (
// Use Cell to render an expander for each row.
// We can use the getToggleRowExpandedProps prop-getter
// to build the expander.
<span {...row.getToggleRowExpandedProps()}>
{row.isExpanded ? '????' : '????'}
</span>
),
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能使用
跨度
。应该是&lt; fontaweshoneicon iCon = {..} /&gt; < /code>。
这是工作 codesandbox 带有
>字体很棒
。您必须关注安装 steps 。发布该-TOUPTUN-You can't use
span
. Should be<FontAwesomeIcon icon={..} />
.Here is the working codesandbox with
font awesome
. You must follow installation steps. Post that -Output -