What happens if a component does not consume context?
const ThemeContext = React.createContext("light");
function ParentComponent() {
return (
<ThemeContext.Provider value="dark">
<ChildComponent />
</ThemeContext.Provider>
);
}
function ChildComponent() {
return <p>Child Component</p>;
}
It will display "dark"
It will display "light"
It will display "Child Component"
It will throw an error
This question is part of this quiz :
Context API