how can I show the data fetched from an API in useEffect on the react component immediately code example
Example: how to fetch data with useEffect
useEffect(() => {
const fetchData = async () => {
const result = await fetch(
'https://my-api.com',
);
setState(result);
};
fetchData();
}, []);