Answer the question
In order to leave comments, you need to log in
Why is react+redux parent updated?
There are 2 components:
App and AppSmall
AppSmall is nested in App
and App and AppSmall are connected to the store via connect.
Now if I call dispatch on the nested AppSmall, it re-renders along with the parent.
Why.
Maybe that's how it should be???
I need that, as with setState, only the component + (if necessary) descendants are re-rendered.
There is a lot of code, so here it is: codepen.io
PS open the console
Answer the question
In order to leave comments, you need to log in
...
let AppSmallRedux = connect(
(store) => ({ data: store.reducerAppSmall }), // (1)
dispatch => ({
update: () => dispatch({ type: "UPDATE_AppSmall" })
})
)(AppSmall);
...
let AppRedux = connect(
(store) => ({ data: store.reducerApp }), // (2)
dispatch => ({
update: () => dispatch({ type: "UPDATE_App" })
})
)(App);
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question