mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 11:59:17 -05:00
2328dd1705
GitOrigin-RevId: 731f86a2b07cd2c3189e6ca86bba9fbbc913f429
14 lines
301 B
JavaScript
14 lines
301 B
JavaScript
import 'abort-controller/polyfill'
|
|
import { useEffect, useState } from 'react'
|
|
|
|
export default function useAbortController() {
|
|
const [controller] = useState(() => new AbortController())
|
|
|
|
useEffect(() => {
|
|
return () => {
|
|
controller.abort()
|
|
}
|
|
}, [controller])
|
|
|
|
return controller
|
|
}
|