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
- Host: GitHub
- URL: https://github.com/streamich/use-unmount
- Owner: streamich
- License: unlicense
- Created: 2020-09-06T12:47:52.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T20:29:13.000Z (over 2 years ago)
- Last Synced: 2025-07-06T03:07:05.135Z (12 months ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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.