Kvaser CanKing GUI Extensions SDK v7.6.1


Kvaser CanKing GUI Extensions SDK / hooks / useUndo

Function: useUndo()

useUndo<T>(initialState?): IUndoObject<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<T>

The initial undo state.

Returns

IUndoObject<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.