Skip to main content

createContext

function

Lets you create a Context that components can provide or read.

function createContext<T>(defaultValue: T): Context<T>

Import

import { createContext } from '@modular/sdk/editor';

Notes

see
{@link https://react.dev/reference/react/createContext#reference React Docs}
see
{@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet}
example
```tsx import { createContext } from 'react'; const ThemeContext = createContext('light'); function App() { return ( <ThemeContext value="dark"> <Toolbar /> </ThemeContext> ); } ```