1.0.0 • Published 4 years ago
use-unmount v1.0.0
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.
1.0.0
4 years ago