Question · JavaScript and React course · Module 5: useEffect and Custom Hooks

useEffect Without Dependency Array

What happens when we do NOT pass a dependency array to useEffect (no second argument)?

Answer options

  • The effect will run only once after mounting
  • React will throw an error about the missing argument
  • The effect will run after every component render
  • The effect will never run

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