0
votes

I've use my app global state in a component with mapStateToProps . My question is which is the best way to use props . By doing mapStateToProps in parent , get the props and then passing to the child or to do the mapStateToProps in the child .

I'm doing some optimization when my react components should update or not.

1

1 Answers

2
votes

This is a redux question, right? If you can isolate a slice of state to a component subtree then you probably want to connect that slice of state to the root of that subtree so that ancestor components and siblings don't have to re-render every time it does. It also makes it easier to get the necessary props to the component in question (without worrying about passing them through all intermediate components.) See reactjs/redux#419 for more.