小编dav*_*nci的帖子

带有react-markdown的新行

我试图从 firebase 数据库中提取 markdown 字符串,然后使用react-markdown 将其渲染到组件中。但 Markdown 字符串无法正确显示。我认为问题是由于从新行开始。

我试图声明我在其中放置 markdown 的变量。有用。 在组件中创建的 markdown 字符串

但是从 firebase 数据库中提取的 markdown 字符串。它显示不正确。 从 firebase 数据库中提取的 markdown 字符串

这是我的代码

export default function BlogTemplate() {
  const { id } = useParams();
  useFirestoreConnect([
    {
      collection: "communications",
      doc: id
    }
  ]);
  const post = useSelector(
    state =>
      state.firestore.data.communications &&
      state.firestore.data.communications[id]
  );

  if (post) {
    const input =
      "# This is a header\n\nAnd this is a paragraph \n\n # This is header again"; // this is a markdown …
Run Code Online (Sandbox Code Playgroud)

markdown firebase reactjs

5
推荐指数
2
解决办法
2万
查看次数

标签 统计

firebase ×1

markdown ×1

reactjs ×1