Passing/Accessing props in stateless child component

后端 未结 8 2014
南方客
南方客 2020-12-05 10:04

I know you can pass all a react components props to it\'s child component like this:

const ParentComponent = () => (
   

Parent

8条回答
  •  醉酒成梦
    2020-12-05 11:04

    Using this

    const ParentComponent = ({ prop1, prop2, prop3 }) => (
       

    Parent Component

    ); const ChildComponent = ({ prop1, prop2, prop3 }) =>{

    Child Component with prop1={prop1}

    Child Component with prop2={prop2}

    Child Component with prop2={prop3}

    }

提交回复
热议问题