Skip to content

useDeviceActions

useDeviceActions(id): DeviceActions

Defined in: console-sdk/src/react/hooks/useDeviceActions.ts:93

Per-device actions for the given device (SDK_PLAN.md §3.6.3). Methods are identity-stable per id and always callable; per the paired-verb contract (§3.8.3) the bare verbs never reject (failure routes to state / the reporter). A null | undefined id is legal (§3.2.6) and returns the shared dev-warned no-op set — no conditional hook calls. Throws OutsideProviderError when no <ConsoleProvider> is above the caller.

DeviceId | null | undefined

the device to act on, or null | undefined for inert actions.

DeviceActions

const { disconnect, forget, setAutoReconnect } = useDeviceActions(device.id);
<Switch value={device.autoReconnect} onValueChange={setAutoReconnect} />;