Question · JavaScript and React course · Module 4: Context API and useReducer

useReducer vs useState

When is useReducer a better choice than useState?

Answer options

  • Always, because it's faster
  • Only in class components
  • Only when using Context API
  • When state logic is complex and contains many related values

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