Click in order · JavaScript and React course · Module 5: useEffect and Custom Hooks

Async Functions in useEffect

Arrange the async invocation pattern in useEffect:

Items to click

  • }, [url]);
  • useEffect(() => {
  • const fetchData = async () => {
  • const res = await fetch(url);
  • fetchData();
  • };
  • setData(await res.json());

You can check the correct answer by solving this task in the CodeWorlds game.