-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Correct me if I'm wrong.
I noticed in Connect component's handleChange() method, each time store state changes, the setState() method is triggered. So each time the store state changes, all mounted container component generated by Connect() will fire setState(), and in turn, shouldComponentUpdate() would be called, and as long as store state changes, render() will be called.
I wonder if we can do a "reference equality check" before setState() is called. Would this eliminate many unnecessary calls to render() and improve performance?
My understanding is the setState() is designed for UI's local state, not the global state change irrelevent to this component. So that any state change will trigger all container component's method should be avoided.