How can you handle asynchronous side effects in useEffect?
Because function passed to useEffect can not be an async function
=> Use an async function within the effect or call it inside
useEffect(() => {
const fetchData = async () => {
const result = await fetch('https://api.example.com/data');
console.log(await result.json());
};
fetchData();
}, []);