UNPKG

beautiful-react-hooks

Version:

A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development

13 lines (12 loc) 444 B
import useDidMount from './useDidMount'; import useWillUnmount from './useWillUnmount'; /** * Returns an object wrapping lifecycle hooks such as `useDidMount` or `useWillUnmount`. * It is intended as a shortcut to those hooks. */ const useLifecycle = (mount, unmount) => { const onDidMount = useDidMount(mount); const onWillUnmount = useWillUnmount(unmount); return { onDidMount, onWillUnmount }; }; export default useLifecycle;