title: TypeError: Cannot read property 'home_address' of undefined
body: <p>I know <code>line#24</code> runs before <code>useEffect()</code>. How to resolve this!! It is showing error that can not read property of <code>undefined</code>. You can also check data coming from <code>API</code> in <code>POSTMAN</code>.</p>
  <pre><code>1.  function App() {
  2.  const[apiData,setApiData]=useState([]);
  3.  const id=13
  5.    useEffect(() =&gt; {
  6.      async function loadData(url) {
  7.        let response = await fetch(url, {
  8.          method: 'POST',
  9.          headers: { 'Content-Type': 'application/json' },
  10.         // body: JSON.stringify({id:13})
  11.       })
  12.       let data = await response.json();
  13.       console.log(data)
  15.       setApiData(data);
  17.     }
  18.     loadData(`http://eign-backend.herokuapp.com/property/get-property/${id}/`);
  19.   }
  20.     , [])
  21.   
  22.   return (
  23.     &lt;div className=&quot;App&quot;&gt;
  24.     &lt;h1&gt;{apiData[0].home_address}&lt;/h1&gt;
  25.       &lt;/div&gt;
  27.   );
  28. }
  29. export default App;
  </code></pre>