title: Cannot read property 'undefined' of undefined in react test renderer using context provider
body: <p>My react component i use (useContext):</p>
  <pre><code>&lt;Fragment&gt;
          &lt;div data-testid=&quot;question_div&quot; className=&quot;question-container&quot;&gt;
          &lt;p&gt;{questionNumber+1}) {qAndA[questionNumber].question}&lt;/p&gt;
          {qAndA[questionNumber].img ? (&lt;img className=&quot;q_img&quot; alt=&quot;question_img&quot; src={qAndA[questionNumber].img}&gt;&lt;/img&gt;) : (&lt;div className=&quot;holdPlace&quot;&gt;&lt;/div&gt;) }
          &lt;/div&gt;
      &lt;/Fragment&gt;
  </code></pre>
  <p>my component.test:</p>
  <pre><code>const fileURL = &quot;data.json&quot;;
  let timer = 1500;
  let questionNumber = 1;
  let qAndA = [];
  beforeAll(() =&gt; {
  axios.get(fileURL)
  .then(res =&gt;{
      qAndA = res.data.qaa;
  })
  .catch(err =&gt;{
  })
  });
  test(&quot;Test the output of &lt;Questions/&gt;&quot;, () =&gt; {
  const element = new TestRenderer.create(
      &lt;GameContext.Provider value={qAndA, questionNumber}&gt;
          &lt;Question /&gt;
      &lt;/GameContext.Provider&gt;
  );
  const testInstance = element.root;
  </code></pre>
  <p>I pass in qAndA + questionNumber values but i still get this error during testing:</p>
  <pre><code>TypeError: Cannot read property 'undefined' of undefined
  
    10 |         &lt;Fragment&gt;
    11 |             &lt;div data-testid=&quot;question_div&quot; className=&quot;question-container&quot;&gt;
  &gt; 12 |             &lt;p&gt;{questionNumber+1}) {qAndA[questionNumber].question}&lt;/p&gt;
       |                                          ^
  </code></pre>
  <p>Any clues? both react and react-dom have the same version.</p>