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

***

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

# Function: useUndoRef()

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

Custom hook to manage undo/redo state using a ref (does not trigger re-renders by default).

## Type Parameters

### T

`T`

The type of the undo/redo data.

## Parameters

### initialState?

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

The initial undo state.

## Returns

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

An undo object for managing state history.

## Remarks

This hook uses useRef and does not automatically trigger component re-renders.
Use the subscribe method if you need to trigger re-renders on state changes, or use useUndo instead.
