overleaf/services/web/frontend/js/shared/hooks/use-abort-controller.js
Alf Eaton ec31473f8f Merge pull request #5736 from overleaf/ab-drop-ie11-polyfill
Remove IE11 polyfills and update browser support policy

GitOrigin-RevId: 9ab9513ecf97fc565a1d2620f9785a64bd16b766
2021-11-17 09:03:32 +00:00

13 lines
266 B
JavaScript

import { useEffect, useState } from 'react'
export default function useAbortController() {
const [controller] = useState(() => new AbortController())
useEffect(() => {
return () => {
controller.abort()
}
}, [controller])
return controller
}