Files
react.dev/examples/context/updating-nested-context-context.js
tjallingt 6521a654cb Added updating nested context default value example (#780)
* added context default value example

* Implement suggested change

* noop function as default value to createContext
2018-04-09 11:12:02 -07:00

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: () => {},
});