属性值可以包含内联样式吗?

时间:2019-01-26 21:12:15

标签: reactjs properties inline-styles

尝试创建包含道具标题和文本的BlogPost组件。我无法对帖子文本实施文本样式设置。文本如何包含斜体“” 属性值字符串中的,强,锚链接或其他html文本样式? 还是有另一种方法来创建此组件结构广告,以使其在创建博客文章时易于管理?

示例:

    App.js

    <article>
              <BlogPost
                title = "Definition - Software developer"
                text = "According to Wikipedia: A software developer is a person concerned with facets of the software development process, including the research, design, programming, and testing of computer software. Other job titles which are often used with similar meanings are programmer, software analyst, and software engineer. ..The single individual is also called by the name God and speaks the language of C."
              />
</article>

    BlogPost.js

    return (
    <div>
      <h2 id="postHeader"> {title} </h2>
      <p className="PostText"> {text} </p>
    </div>
  )

1 个答案:

答案 0 :(得分:1)

使用此软件包react-markdown