title: React Native data in context is undefined on the first render
body: <p>I use <code>AppContext</code>, when I fetch data from server I want it to save in context but on the first render it doesn't save. If I make something to rerender state data appears in context.</p>
  <p>Here is my code:</p>
  <pre><code>useEffect(() =&gt; {
    fetch('https://beautiful-places.ru/api/places')
      .then((response) =&gt; response.json())
      .then((json) =&gt; myContext.updatePlaces(json))
      .then(() =&gt; console.log('jsonData', myContext.getPlaces()))
      .catch((error) =&gt; console.error(error));
  }, []);
  </code></pre>
  <p>My <code>getPlaces</code> and <code>updatePlaces</code> methods:</p>
  <pre><code>const [allPlaces, setAllPlaces] = useState();
  
  const getPlaces = () =&gt; {
    return allPlaces;
  };
  
  const updatePlaces = (json) =&gt; {
    setAllPlaces(json);
  };
  
  const placesSettings = {
    getPlaces,
    updatePlaces,
  };
  </code></pre>
  <p>Here is how I use <code>AppContext</code>:</p>
  <pre><code>&lt;AppContext.Provider value={placesSettings}&gt;
    &lt;ThemeProvider&gt;
      &lt;LoadAssets {...{ assets }}&gt;
        &lt;SafeAreaProvider&gt;
          &lt;AppStack.Navigator headerMode=&quot;none&quot;&gt;
            &lt;AppStack.Screen
              name=&quot;Authentication&quot;
              component={AuthenticationNavigator}
            /&gt;
            &lt;AppStack.Screen name=&quot;Home&quot; component={HomeNavigator} /&gt;
          &lt;/AppStack.Navigator&gt;
        &lt;/SafeAreaProvider&gt;
      &lt;/LoadAssets&gt;
    &lt;/ThemeProvider&gt;
  &lt;/AppContext.Provider&gt;;
  
  </code></pre>
  <p>Could you explain please why my <code>console.log('jsonData', ...)</code> returns <code>undefined</code>?</p>
  <p>I don't understand because on previous <code>.then</code> I saved it.</p>