Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nudelx/react-promise-hook


https://github.com/nudelx/react-promise-hook

Last synced: 16 days ago
JSON representation

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

![demo](https://raw.githubusercontent.com/nudelx/react-promise-hook/master/img/demo.gif)

## Installation

```
npm i react-promise-hook
```

or

```
yarn add react-promise-hook
```

---

Made with ♥ by nudelx