React - How to pass HTML tags in props?

前端 未结 20 1298
甜味超标
甜味超标 2020-12-07 11:58

I want to be able to pass text with HTML tags, like so:

not working.\" />

Bu

20条回答
  •  一整个雨季
    2020-12-07 12:44

    Adding to the answer: If you intend to parse and you are already in JSX but have an object with nested properties, a very elegant way is to use parentheses in order to force JSX parsing:

    const TestPage = () => (
      
        This is a test text!

    ) }}>
    );

提交回复
热议问题