title: Function call inside useEffect not firing in jest test
body: <p>I have a component that, on button click sends the updated value to parent via <code>props.OnValChange</code>. This is implemented in the <code>useEffect</code> hook.
  If I console log the useEffect I can see it being called. But in my test when I do <code>expect(prop.OnValChange).toHaveBeenCalledTimes(1);</code> it says it was called 0 times.</p>
  
  <p>Component:</p>
  
  <pre><code>const MyComp = ({OnValChange}) =&gt; {
      const [ val, setVal ] = useState(0);
  
      useEffect(() =&gt; {
          console.log("before");
          OnValChange(val);
          console.log("after");
      }, [val]);
  
      return (
          &lt;button onClick={() =&gt; setVal(val + 1)}&gt;Count&lt;/button&gt;
      )
  }
  </code></pre>
  
  <p>Test:</p>
  
  <pre><code>it("Sends val to parent when button is clicked", () =&gt; {
      const prop = {
          OnValChange: jest.fn();
      }
  
      const control = mount(&lt;MyComp {...prop} /&gt;);
  
      expect(prop.OnValChange).toHaveBeenCalledTimes(0);
      control.find(button).simulate("click");
      expect(prop.OnValChange).toHaveBeenCalledTimes(1);
  }) 
  </code></pre>