atomico
Version:
Atomico is a small library for the creation of interfaces based on web-components, only using functions and hooks.
13 lines (9 loc) • 326 B
JavaScript
import { useMemo, useEffect } from "../hooks.js";
/**
* @type {import("core").UseAbortController}
*/
export const useAbortController = (args) => {
const abortController = useMemo(() => new AbortController(), args);
useEffect(() => () => abortController.abort(), [abortController]);
return abortController;
};