Quiz
Context API
10 questions
createContext, Provider, useContext, and patterns to avoid re-renders
01What is the main purpose of React's Context API?
02What value does useContext(MyContext) receive when there is no Provider in the tree?
03When does a Context consumer re-render?
04Why can <MyCtx.Provider value={{ theme, setTheme }}> cause unnecessary re-renders?
05Can a component consume multiple Contexts at the same time?
06What strategy prevents components that only read setTheme from re-rendering when theme changes?
07Can multiple instances of the same Provider be nested in the tree?
08What is the main limitation of Context for complex global state management?
09What does useContext return when the component is inside the Provider but its value is undefined?
10What is the recommended way to expose a Context to consumers?
Was this helpful?
Sign in to give feedback
