State Management · Junior · Question 19 of 75

What are the steps to use Context?

Explanation

const ThemeContext = createContext('light'); in React 19 you can render <ThemeContext value={theme}> directly (earlier versions used <ThemeContext.Provider>); any descendant calls useContext(ThemeContext).

Further reading

Problem with a question

State Management · Junior · question 19

Test yourself

Take the State Management · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz