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

Multiple Providers

What happens when a component is between two Providers of the same context?

Answer options

  • It uses values from both Providers simultaneously
  • It uses the default context value
  • A compilation error occurs
  • It uses the value from the nearest Provider in the component tree

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