Question · JavaScript and React course · Module 9: Modern React Hooks

use() Hook vs useContext

What is the key advantage of the new use() hook over useContext when reading context?

Answer options

  • use() can be called conditionally (in if/else blocks), which useContext does not allow
  • use() automatically memoizes the context value
  • use() is faster because it bypasses reconciliation
  • use() only works with Server Components

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