Learning React with useEffect and Fetch API

🚀 Learning React: Fetching Data with useEffect While learning React, I practiced fetching blog data from a local JSON file using the fetch() API and the useEffect hook. 👉🏾I learned how to: 👉🏾Fetch data from an API 👉🏾Convert the response to JSON 👉🏾Store data in state using useState 👉🏾Use useEffect to load data when the component mounts  useEffect(()=>{      fetch('http://localhost:8000/blogs')      .then(res =>{        return res.json();      })      .then(data =>{          setBlogs(data);      })   }   ) Small steps, but a big boost in understanding React fundamentals 💡 #ReactJS #JavaScript #LearningInPublic #Frontend #WebDevelopment

To view or add a comment, sign in

Explore content categories