Answers for "how to have a function inside useeffect"

0

how to have a function inside useeffect

useEffect(() => {
  fetch(`https://jsonplaceholder.typicode.com/${query}`)
    .then(response => response.json())
    .then(json => setData(json));
}, [query]); // only re-run on query change
Posted by: Guest on May-06-2020

Code answers related to "how to have a function inside useeffect"

Code answers related to "Javascript"

Browse Popular Code Answers by Language