What is Context and when would you use it?

React refs, context and custom hooks · Freshers

Model answer

Context lets a parent share a value with all components below it without passing props at every level. You create it with createContext, provide a value with a Provider, and read it with useContext.

Good uses: theme, current user, language. It is not a complete state manager, and every consumer re-renders when the value changes.

Learn this topic

React Context API Explained: Share Data Without Passing Props in the course React.js Full Course: Beginner to Advanced.

Sign in to add your own answer.

More questions