Is good practice to pass state as props to children?

Posted by Jennifer | Updated on

Is good practice to pass state as props to children?

Yes, State should only be set on the top level element, this ensures that data only ever flows one way through your components.

Bear in mind, React will only render the changes that have been made since the last render, if parts of your child elements haven’t been modified they will not be re-rendered to the DOM. React has a section in their docs titled lifting up state.

Reference:
https://stackoverflow.com/questions/29796435/is-good-practice-to-pass-state-as-props-to-children


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers