UNPKG

@winglet/react-utils

Version:

React utility library providing custom hooks, higher-order components (HOCs), and utility functions to enhance React application development with improved reusability and functionality

15 lines (12 loc) 305 B
import { useEffect, useLayoutEffect } from 'react'; const useOnUnmount = (handler) => { useEffect(() => { return handler; }, []); }; const useOnUnmountLayout = (handler) => { useLayoutEffect(() => { return handler; }, []); }; export { useOnUnmount, useOnUnmountLayout };