I want to execute a function in Child Component after props gets changed in the Parent Component without having to manage an extra state in Child/Parent.
<ParentCompoenent
myCallback={() => {}}
myList={['a','b','c']}
/>
ChildComponent.js
componentWillReceiveProps(nextProps) {
console.log(this.props.myList, '==', nextProps.myList); // Outputs ['a','b','c'] == ['a','b','c']
}
When I'm trying to console the nextProps in componentWillReceiveProps its giving the same result every time even after the props have been changed.