[**Kvaser CanKing GUI Extensions SDK v7.5.1**](../../README.md)

***

[Kvaser CanKing GUI Extensions SDK](../../modules.md) / [hooks](../README.md) / useProjectDataSlice

# Function: useProjectDataSlice()

> **useProjectDataSlice**\<`T`\>(`id`, `slice`, `defaultValue`, `loadedCallback?`): \[`T`, `Dispatch`\<`SetStateAction`\<`T`\>\>, `boolean`\]

A hook for data that should be saved to the current project.

## Type Parameters

### T

`T`

## Parameters

### id

`number`

The unique id of the view.

### slice

`string`

The slice name for the project 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`\]

An object with a flag indicating if the project data has been initialized, the current project data and a setter callback.
