@kvaser/canking-api
Version:
CanKing API to communicate with the CanKing service using Node.js.
56 lines (28 loc) • 920 B
Markdown
[**Kvaser CanKing GUI Extensions SDK v7.5.1**](../../README.md)
***
[Kvaser CanKing GUI Extensions SDK](../../modules.md) / [hooks](../README.md) / useSessionData
# Function: useSessionData()
> **useSessionData**\<`T`\>(`id`, `defaultValue`, `loadedCallback?`): `object`
A hook for data that should be saved to the session data.
## Type Parameters
### T
`T`
## Parameters
### id
`number`
The unique id of the view.
### defaultValue
The default value or a function that returns the default value.
`T` | () => `T`
### loadedCallback?
(`value`) => `void`
Optional callback invoked once after data is loaded.
## Returns
`object`
An object with the current session data, a setter, and an initialization flag.
### sessionData
> **sessionData**: `T`
### sessionDataIsInitialized
> **sessionDataIsInitialized**: `boolean`
### setSessionData
> **setSessionData**: `Dispatch`\<`SetStateAction`\<`T`\>\>