DEV Community

Rohit Maurya
Rohit Maurya

Posted on

Modern API data-fetching methods in React

useEffect(() => {
fetch(https://jsonplaceholder.typicode.com/posts)
.then((response) => response.json())
.then((actualData) => console.log(actualData))
.catch((err) => {
console.log(err.message);
});
}, []);

Top comments (0)