Function: useCommandExecutor()
ts
function useCommandExecutor(): CommandExecutor;Defined in: src/wirestate-react/commands/use-command-executor.ts:28
Returns a stable function to dispatch commands on the active container.
Returns
A command executor function that takes a type and optional data.
Remarks
The returned executor is memoized using useCallback and stays stable for the lifetime of the container. It uses CommandBus.command internally.
Example
tsx
const executeCommand: CommandExecutor = useCommandExecutor();
const onClick = () => executeCommand("SAVE_USER_COMMAND", { id: 1 });