title: useSelector of Undefined
body: <p>Hi I am writting unit testing for a component it has redux in it. While testing it , throws an error UseSelector state undefined. UseSelector will be updated once after getting response from the api. Till that its value is undefined. But while unit tetsing it throws error on the first itself . How to overcome this issue.</p>
  
  <p>Test File</p>
  
  <pre><code>import React from 'react';
  import { render, fireEvent } from '@testing-library/react';
  import { act } from 'react-dom/test-utils';
  import '@testing-library/jest-dom/extend-expect';
  import { createStore } from 'redux';
  import { Provider } from 'react-redux';
  import LinkApplication from '../index';
  import {reducer} from '../../../redux/summary/reducer';
  let INITIAL_STATES = {
      isFetching: false,
      errorMessage: "",
      requestExtensionErrorMessage: "",
      requestExtensionSuccessMessage: "",
      linkApplicationSuccess: "",
      linkApplicationFailure: null,
      linkLoanSuccessMessage: "",
      linkLoanErrorMessage: "",
      LinkApplicationErrorMessage:"",
    };
  function renderWithRedux(
    component,
    { INITIAL_STATES, store = createStore(reducer, INITIAL_STATES) } = {},
  ) {
    return {
      ...render(&lt;Provider store={store}&gt;{component}&lt;/Provider&gt;),
    };
  }
  it('sumbits the form', async () =&gt; {
    const onSubmit = jest.fn();
    const { getByText, getByTestId } = renderWithRedux(
      &lt;LinkApplication onSubmit={onSubmit} /&gt;,
    );
    const Dob_Input = getByTestId('dob-input');
    const Phone_Input = getByTestId('phone-input');
    const form = getByTestId('form');
    act(() =&gt; {
      fireEvent.keyPress(Dob_Input, {
        target: { value: '1995-09-27' },
      });
      fireEvent.keyPress(Phone_Input, { target: { value: '9500902621' } });
    });
    expect(Dob_Input.value).toBe('1995-09-27');
    expect(Phone_Input.value).toBe('9500902621');
    await act(() =&gt; {
      fireEvent.submit(form);
    });
    expect(onSubmit).not.toHaveBeenCalled();
  })
  </code></pre>
  
  <p>Component</p>
  
  <pre><code>const LinkApplication = () =&gt; {
    const dispatch = useDispatch();
    let LinkApplicationErrorMessage = useSelector(
      state =&gt; state.summary.linkApplicationFailure
    );
  }
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>TypeError: Cannot read property 'linkApplicationFailure' of undefined
  const dispatch = useDispatch();
  let LinkApplicationErrorMessage = useSelector(
  state =&gt; state.summary.linkApplicationFailure
  ^
  );
  
  </code></pre>
  
  <p>Please help me with that.</p>