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

Return Value from Cleanup in useEffect

What should the cleanup function in useEffect return?

Answer options

  • A Promise that resolves after cleanup is complete
  • An object with information about the effect completion status
  • Nothing - cleanup is a void function that cleans up resources (timers, subscriptions, listeners)
  • A new component state value after unmounting

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