Answer the question
In order to leave comments, you need to log in
React + Redux, how to write to state after data arrives?
Good evening, I make a request to the server in componentDidMount ()
And after I get the props, I need to update the state.
How to check it?
Answer the question
In order to leave comments, you need to log in
static getDerivedStateFromProps(props, state) {
if (props.visas[0] !== state.visa) {
return {
visa: props.visas[0],
};
}
return null;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question