UNPKG

@kvaser/canking-api

Version:

CanKing API to communicate with the CanKing service using Node.js.

39 lines (20 loc) 815 B
[**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.