title: Jest Unit test case for React functional component Api call
body: <p>I am new to Jest Unit testing. I need to write a test case for a React functional Component. Below is the code snippet for API call</p>
  <pre><code>  useEffect(() =&gt; {
      getInitialData(props.id, props.baseUrl).then((response: any) =&gt; {
        setInitialResponse(response.initialResponse);
        if (props.initialData) props.initialData(response.initialResponse);
        setLoader(false);
      });
    }, []);
  </code></pre>
  <p>I don't know how to cover these lines in the jest test case. Passing id and baseUrl to this component, not covering lines after 'then'. I don't know How can I mock this also as it is present inside <code>useEffect</code>.</p>