title: problem in useEffect hook to fetch api in React.js
body: <p>This is bootcamp.js file in react project</p>
  <pre><code>import React, { Component, useState, useEffect } from 'react';
  
  const Bootcamps = () =&gt; {
    const [error, setError] = useState(null);
    const [isLoaded, setIsLoaded] = useState(false);
    const [bootcamps, setBootcamps] = useState();
  
    const loadData = async () =&gt; {
      const response = await fetch('http://localhost:5000/api/v1/bootcamps');
      const data = await response.json();
  
      setIsLoaded(true);
      setBootcamps(data);
      console.log(data);      // showing data
      console.log(bootcamps); // showing undefined
    };
  
    useEffect(() =&gt; {
      loadData();
    }, []);
  
  ........
  ......
  ...
  </code></pre>
  <p>the console.log(bootcamps) is showing undefined. Plzz help</p>