React - How to pass HTML tags in props?

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

    We can do the same thing in such a way.

    const Child = () => {
      return (
         write your whole HTML here.
      )
    }
    

    now you want to send this HTML inside another component which name is Parent component.

    Calling :-

    } >
     
    

    Use Of Child:-

     const Parent = (props) => {
       const { child } = props; 
       return (
           {child}
        )
    }
    

    this work perfect for me.

提交回复
热议问题