import { useCallback , useState } from 'react' ; export function useErrorHandler ( ) { const [ , setError ] = useState ( ) ; const handleError = useCallback ( ( e ) => { setError ( ( ) => { throw e ; } ) ; } , [ ] ) ; return handleError ; }