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

https://github.com/streamich/use-unmount

React hook which returns unmount observable
https://github.com/streamich/use-unmount

Last synced: 11 months ago
JSON representation

React hook which returns unmount observable

Awesome Lists containing this project

README

          

# use-unmount

React hook that returns a single RxJS observable, which emits once `true` when
the component un-mounts.

Install

```
yarn add use-unmount
```

Use

```js
import {useUnmount$} from 'use-unmount';

const Component = () => {
const unmount$ = useUnmount$();

const onClick = () => {
createUser$({name})
.pipe(takeUntil(unmount$))
.subscribe(() => { /* ... */ });
};
};
```

## License

[Unlicense](LICENSE) — public domain.