在模板文字中添加标签



是否有可能在模板文字中添加标签,将用于在ReactJS中填充标签?示例:previewdescription

const data = {
activeProjectId: null,
modalShow: false,
projectsFlipped: false,
menuShow: false,
projects: [
{
id: 'project-title-0',
title: 'Hello there!'.toUpperCase(),
image: project11,
medium: 'React, 3.js, SCSS, HTML',
previewDescription:
`This portfolio site is built on React,  uses Three.js for the flying star animations, and  a mix of CSS transforms and vanilla JS scrolling for the page transitions.  For the best effect, view while listening to` +
(
<a href="https://www.youtube.com/watch?v=5qap5aO4i9A">
LoFi music
</a>
) +
`.`,
link: 'https://github.com/justanothergoonie/codys-portfolioo',
gitLink: 'https://github.com/justanothergoonie/codys-portfolioo',
},

您要查找的是dangerlysetinnerhtml。

const stringContainingHtml = "here is the <b>html</b> string"
const jsxElement = <div dangerouslySetInnerHTML={{ __html: stringContainingHtml }}/>

最新更新