React - How to pass HTML tags in props?

前端 未结 20 1358
甜味超标
甜味超标 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:21

    You can successfully utilize React fragments for this task. Depending on the React version you use, you can use short syntax: <> or the full tag: . Works especially well if you don't want to wrap entire string within HTML tags.

    Hello World. Don't be so ruthless.} />
    

提交回复
热议问题