React props vs children . What to use when?

后端 未结 5 496
伪装坚强ぢ
伪装坚强ぢ 2021-01-12 05:50

What is the difference between the two approaches ?

Passing text for a button as props

   

    function TextCo         


        
5条回答
  •  萌比男神i
    2021-01-12 06:22

    You use props.children on a component which acts as a container and does not know about their children ahead of time.

    Basically props.children it is used to display whatever you include between the opening and closing tags of the "containing" component when invoking it.

提交回复
热议问题