use-unmount
v1.0.0
Published
React hook that returns a single RxJS observable, which emits once `true` when the component un-mounts.
Downloads
3
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
import {useUnmount$} from 'use-unmount';
const Component = () => {
const unmount$ = useUnmount$();
const onClick = () => {
createUser$({name})
.pipe(takeUntil(unmount$))
.subscribe(() => { /* ... */ });
};
};
License
Unlicense — public domain.