title: How to make useEffect hook call the provided effect only if all the elements in inputs change?
body: <p>I'm trying to convert UNSAFE_componentWillReceiveProps into a hook. Below is the logic for using CWRP.</p>
  
  <pre><code>UNSAFE_componentWillReceiveProps(nextProps){
    if (this.props.val1 !== nextProps.val1 &amp;&amp; this.props.val2 !== nextProps.val2) {
      // do something
    }
  }
  </code></pre>
  
  <p>Is there any way I can tell hook to call effect only when val1 &amp; val2 changes.</p>
  
  <pre><code>useEffect(() =&gt; {
    // do something only when both inputs change 
  }, [val1, val2])
  </code></pre>