How do I pass parent state to its child components?

前端 未结 2 2010
旧时难觅i
旧时难觅i 2021-02-01 07:27

I am new in React ES6 and I think I am modifying the state in a wrong way. My code is like this when I set state on parent component:

class App extends React.Com         


        
2条回答
  •  萌比男神i
    2021-02-01 08:11

    if you want to send the whole state :

    return(  );
    

    But this is likely a bad idea :)

    edit: in your scenario, this sends a 'name' property to child component with value 'helloworld'

提交回复
热议问题