Answer the question
In order to leave comments, you need to log in
How to listen for a change in props?
Hello, how to understand that props has changed?
That is, I have some data in the component (com1), which I send from another component (com2) and I need to do some actions in com1, when the data in props changes
Answer the question
In order to leave comments, you need to log in
componentDidUpdate(prevProps) {
if (prevProps.someProp !== this.props.someProp) {
// do something
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question