• Hook returning a dispatcher for the application's Msg union.

    Type Parameters

    • Msg

      The application's message union.

    Returns Dispatch<Msg>

    A stable dispatcher; identity changes only when the graph handle or the update runner identity changes on the surrounding provider.

    Error when called outside <CauslProvider>, or when the provider was not configured with an update runner.

    The provider must be configured with an update function (see CauslProviderProps). If it is not, calling the dispatcher throws — the throw is deferred to call time so a component can be rendered under a read-only provider without crashing at mount.

    const dispatch = useDispatch<Msg>()
    return <button onClick={() => dispatch({ kind: 'edit-cell', ref, value })}>Save</button>