0
我想渲染一个有注释的html组件,以便评论在DOM中显示为注释。在反应组件的html中渲染评论
我现在有
<head>
<title>{props.pageTitle}</title>
</head>
但我想有
<head>
<title>{props.pageTitle}</title>
<!-- Some information here -->
</head>
而且我想避免使用下列内容:
dangerouslySetHtml
element.innerHTML = "...";
element.outerHTML = "...";
的可能的复制[如何呈现反应的HTML注释?](https://stackoverflow.com/questions/40015336/how-to-render-a-html-comment-in-react) – Li357
另请参阅https://stackoverflow.com/q/40381851/5647260 – Li357
所有这些解决方案都使用内部,外部或危险 – es3735746