【问题标题】:How can I implement react-markdown within a react-table cell?如何在 react-table 单元格中实现 react-markdown?
【发布时间】:2021-03-28 19:28:05
【问题描述】:

在我目前正在开发的应用程序中,有一个“描述”列,我希望它有富文本。这将以 Markdown 格式存储在我的数据库中。无论如何,当使用 react-table 让单元格包含另一个组件中的内容时,在这种情况下,内容可以通过 react-markdown 呈现吗?

在实现 react-table 之前,我能够使用 <td><ReactMarkdown>{item.description}</ReactMarkdown></td> 解析描述单元格中的降价,但我没有看到使用 react-table 完成此操作的方法。

这是有问题的代码:https://github.com/TechValleyCenterOfGravity/STUFF/blob/main/src/App.js

【问题讨论】:

  • 我能够找出column options并添加了以下cell: props => <ReactMarkdown>{ props.value }</ReactMarkdown>,不幸的是markdown仍然没有被解析。

标签: reactjs react-table react-markdown


【解决方案1】:

我错过了一个大写 C - Cell: props => <ReactMarkdown>{ props.value }</ReactMarkdown> 成功了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-04
    • 2019-05-22
    • 2021-11-22
    • 1970-01-01
    • 2022-01-01
    • 1970-01-01
    • 2019-05-25
    • 1970-01-01
    相关资源
    最近更新 更多