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

***

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

# Function: useUndo()

> **useUndo**\<`T`\>(`initialState?`): [`IUndoObject`](../interfaces/IUndoObject.md)\<`T`\>

Custom hook to manage undo/redo state with automatic re-renders.

## Type Parameters

### T

`T`

The type of the state being managed.

## Parameters

### initialState?

[`IUndoState`](../interfaces/IUndoState.md)\<`T`\>

The initial undo state.

## Returns

[`IUndoObject`](../interfaces/IUndoObject.md)\<`T`\>

An undo object for managing state history with automatic re-renders.

## Remarks

This hook triggers component re-renders whenever the state changes.
If you don't need re-renders, use useUndoRef instead for better performance.
