UNPKG

rn-custom-style-sheet

Version:

React Native component to select a specific value from a range of values.

20 lines (16 loc) 586 B
import { useEffect } from 'react'; import { default as useCreateHandlerSetter } from './UseCreateHandlerSetter'; /** * Returns a callback setter for a function to be performed when the component did mount. */ export default function useDidMount( handler: () => void, deps: React.DependencyList = [] ): (nextCallback: () => void) => void { const [onMountHandler, setOnMountHandler] = useCreateHandlerSetter(handler); useEffect(() => { onMountHandler.current?.(); // eslint-disable-next-line react-hooks/exhaustive-deps }, [...deps]); return setOnMountHandler; }