Answers for "fetch in useeffect"

0

how to fetch data with useEffect

useEffect(() => {
    const fetchData = async () => {
      const result = await fetch(
        'https://my-api.com',
      );
 
      setState(result);
    };
 
    fetchData();
  }, []);
Posted by: Guest on April-10-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language