Answer the question
In order to leave comments, you need to log in
Why is the component not listening to the store?
Why is react not reacting after updating the repository?
the component is connected to the storage with the transport_list
array - it is updated, but the update comes from the component of a direct connection with the current one that does not have one. (like the third level of nesting, I don’t want to drag it, I connected the redux)) I
connect through the redux connect
reacts only after events like onClick or onChange. I need it on the side.
The only solution is how to subscribe Googled only subscribe, but again, how to call the component rerender is not clear. Everywhere examples from the series are hung on the input onChange and passed the event to the ancestor / descendant and called the rerender. Reacts to new information only after the events that I call according to the onChange / onClick scheme
on
componentWillReceiveProps(nextProps){
if(this.props.transport_list !== nextProps.transport_list){
console.log('did update', this.props.transport_list)
}
}
Answer the question
In order to leave comments, you need to log in
The problem was due to the fact that the name of the function (action) and the key matched.
Everywhere examples from the series are hung on the input onChange and passed the event to the ancestor / descendant and called the rerender.
I will assume 2 situations:
1) As you have already been told in the comments, most likely you are "mutating" the array, and not returning a new one. For example, it doesn't suit you, the push method, to add an element and return a new array, use concat .
2) If you connected a component (using connect), and do not props down to the child, which in turn does not props to your component, which does not work and is at the 3rd level, not having a direct connection ... then it will not work must. You can use context to "not skip" , but you probably don't need it right now. So far, I have not had to use context directly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question