I'm trying to convert UNSAFE_componentWillReceiveProps into a hook. Below is the logic for using CWRP.
UNSAFE_componentWillReceiveProps(nextProps){
if (this.props.val1 !== nextProps.val1 && this.props.val2 !== nextProps.val2) {
// do something
}
}
Is there any way I can tell hook to call effect only when val1 & val2 changes.
useEffect(() => {
// do something only when both inputs change
}, [val1, val2])