If you don’t use something in render(),it shouldn’t be in the state.
setState()automatically merge a partial state into the current state.
In React,sharing state is accomplished by moving it up to the closest common ancestor of the components that need it.
Instead of trying to sync the state between different components,you should rely on the top-down data flow.
Remember that components may accept arbitrary props,including primitive values,React elements,or functions.
网友评论