https://github.com/nudelx/react-promise-hook
https://github.com/nudelx/react-promise-hook
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nudelx/react-promise-hook
- Owner: nudelx
- Created: 2018-11-15T08:54:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-15T09:48:17.000Z (over 6 years ago)
- Last Synced: 2024-04-25T15:21:33.080Z (about 1 year ago)
- Language: JavaScript
- Size: 1.05 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Promise Hook
React hook with the promise that gives you an ability to react on after set effect
## Usage
```js
import usePromiseHook from 'react-promise-hook'const App = () => {
const [test, setTest] = usePromiseHook(0)if (!test) {
setTimeout(() => {
setTest(42).then(() => console.log('UPDATED'))
}, 2000)
}return (
🤓
The Answer is {test}
)
}export default App
```## Demo

## Installation
```
npm i react-promise-hook
```or
```
yarn add react-promise-hook
```---
Made with ♥ by nudelx