https://github.com/gabrielmodog/usetimemachine
⏲️ Go forward and backwards with your state.
https://github.com/gabrielmodog/usetimemachine
Last synced: 9 months ago
JSON representation
⏲️ Go forward and backwards with your state.
- Host: GitHub
- URL: https://github.com/gabrielmodog/usetimemachine
- Owner: GabrielModog
- License: mit
- Created: 2023-01-21T03:06:01.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T17:51:41.000Z (over 3 years ago)
- Last Synced: 2024-04-26T06:21:01.020Z (about 2 years ago)
- Language: TypeScript
- Homepage:
- Size: 499 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## ⏲️ useTimeMachine
A simple React.js hook to go forward and backwards with your state.
## Install now
```
yarn add use-time-machine
```
or
```
npm i use-time-machine
```
#### Samples
```jsx
import { useTimeMachine } from "use-time-machine"
function App(){
const {history, sendTo, hasPast, hasFuture} = useTimeMachine([...]);
return
...
}
```
```jsx
import { useHistoryMachine } from 'use-time-machine';
function App() {
const { state, setCurrentState, goFoward, goBackward, resetState } =
useHistoryMachine('test');
return
...;
}
```
by [@GabrielModog](https://twitter.com/gabrielmodog) - say hi!