@kvaser/canking-api
Version:
CanKing API to communicate with the CanKing service using Node.js.
50 lines (25 loc) • 907 B
Markdown
[**Kvaser CanKing GUI Extensions SDK v7.5.1**](../../README.md)
***
[Kvaser CanKing GUI Extensions SDK](../../modules.md) / [hooks](../README.md) / useSessionDataSlice
# Function: useSessionDataSlice()
> **useSessionDataSlice**\<`T`\>(`id`, `slice`, `defaultValue`, `loadedCallback?`): \[`T`, `Dispatch`\<`SetStateAction`\<`T`\>\>, `boolean`\]
A hook for persistent (session) data tied to a specific view slice.
## Type Parameters
### T
`T`
## Parameters
### id
`number`
The unique id of the view.
### slice
`string`
The slice name for the session data.
### 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
\[`T`, `Dispatch`\<`SetStateAction`\<`T`\>\>, `boolean`\]
[state, setState, loaded] the current data, setter, and loaded flag.