)
}
```
### Signature
```ts
export default function useHistory(initialPresent: T): {
state: T
set: (newPresent: T) => void
undo: () => void
redo: () => void
clear: () => void
canUndo: boolean
canRedo: boolean
}
```
## Props
| Prop | Type | Default Value | Required | Description |
| -------------- | ----- | ------------- | -------- | -------------------------------------------------------- |
| initialPresent | `any` | | No | The initial state value to be used for the present state |
## Return Types
| Key | Type | Comments |
| ------- | ----------------------- | -------------------------------------------------------------------------------------------------------- |
| state | `any` | The present state |
| set | `(newState: T) => void` | A function to set the the new present state |
| undo | `() => void` | Moves the most recent past state to the present and the present state to the future |
| redo | `() => void` | Moves the most recent future state to the present and the present state to the past |
| clear | `() => void` | Clears the past and future states and resets the present state to the initial state passed into the hook |
| canUndo | `boolean` | `true` when there are past states |
| canRedo | `boolean` | `true` when there are future states |