我正在使用tinymce 接受来自用户的降价数据。输出数据是html。我想在页面上显示该数据。我正在使用react-markdown。我可以在页面上看到数据,但它是 HTML 标签。有什么方法可以显示 HTML 页面而不是标签吗?
export default function ThePage() {
const markdown = {
description: "<p>Hello from the other </p>\n<p><strong>side</strong></p>",
}
return (
<>
<ReactMarkdown children={markdown.description} />
</>
);
}Run Code Online (Sandbox Code Playgroud)
我正在使用 NextJS 12。我正在尝试获取本地存储对象。当我在内部使用 localstorage 时,getServerSideProps出现这样的错误ReferenceError: localStorage is not defined。我也尝试在函数之外使用它,但仍然收到此错误。有什么办法可以在里面使用吗getServerSideProps?
export async function getServerSideProps({ query }) {
const id = query.id;
const getData = JSON.parse(localStorage.getItem("form"));
console.log(getData)
return {
props: {},
}Run Code Online (Sandbox Code Playgroud)