Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 4x 2x | import { createContext, useContext } from 'react';
/**
* Selection context a `SwitchHandler` provides to its subtree.
* @typedef {Object} SwitchContextValue
* @property {import('./helpers').NormalizedTrigram} defaults - the
* SwitchHandler's normalized default trigram parts
* @property {{tao: import('./helpers').TaoSignal|undefined, data: *}} signal -
* the latest chosen AppCon signal (`tao`/`data` are undefined
* before any match)
*/
/**
* Set by SwitchHandler when wrapping RenderHandlers.
* `null` means RenderHandler is standalone.
* @type {import('react').Context<SwitchContextValue|null>}
*/
export const SwitchContext = createContext(null);
/**
* The nearest SwitchHandler's selection context, or `null` when standalone.
* @returns {SwitchContextValue|null}
*/
export function useSwitchContext() {
return useContext(SwitchContext);
}
|