useEnsureLayoutContext
function useEnsureLayoutContext(layoutContext?): LayoutContextType;Defined in: packages/react/src/hooks/layout/useEnsureLayoutContext.ts:17
Ensures that a layout context is provided, either via context or explicitly as a parameter. If not inside a LayoutContext and no layout context is provided, an error is thrown.
Parameters
| Parameter | Type |
|---|---|
layoutContext? | LayoutContextType |
Returns
Example
const layoutContext = useEnsureLayoutContext();
return <button onClick={() => layoutContext.setPin(null)}>Clear pin</button>;