APIs

createContext

Declare a reusable context identity and fallback at module scope.

Formal Syntax & Structure

react syntaxreact
const Context = createContext(defaultValue);

Working Example

Example Snippetreact
const DensityContext = createContext("comfortable");
React Reference