You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some edge cases we are using subscribe function only to inject props, yet not for subscribing it to the state. In those cases we aren't passing by mapStateToProps.
Despite we consider it an anti-pattern, because we could simply compose the component in order to achieve that, it will be a improvement to not execute all the subscription flow if no mapStateToProps is passed by in the subscribe function.
The main point of this would be to not execute the mapStateToProps if the component does not need to be subscribed to the state. But I can't imagine how to check this without executing the function and checking its returned values. With null will be easier to check it.
Anyway, I'd prefer to use null instead of () => {}. 😛
alexhoma
changed the title
Avoid run all the subscription flow for components not passsing mapStateToProps as argument
Avoid run all the subscription flow for components not passing mapStateToProps as argument
Oct 14, 2019
In some edge cases we are using
subscribe
function only to inject props, yet not for subscribing it to the state. In those cases we aren't passing by mapStateToProps.Despite we consider it an anti-pattern, because we could simply compose the component in order to achieve that, it will be a improvement to not execute all the subscription flow if no
mapStateToProps
is passed by in thesubscribe
function.Now we are passing by an empty fucntion:
This should allow to do this:
The text was updated successfully, but these errors were encountered: