mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
* added context default value example * Implement suggested change * noop function as default value to createContext
9 lines
265 B
JavaScript
9 lines
265 B
JavaScript
// highlight-range{1-2}
|
|
// Make sure the shape of the default value passed to
|
|
// createContext matches the shape that the consumers expect!
|
|
// highlight-range{2-3}
|
|
export const ThemeContext = React.createContext({
|
|
theme: themes.dark,
|
|
toggleTheme: () => {},
|
|
});
|