v2.0.0: useAbortController + Named Exports
🎉 What's New
New Hook: useAbortController
Automatically abort fetch requests and async operations on component unmount.
import { useAbortController } from 'use-is-mounted-ref';
function App() {
const abortController = useAbortController();
useEffect(() => {
fetch('/api/data', { signal: abortController.signal })
.then(res => res.json())
.then(setData);
}, [abortController]);
}💥 Breaking Changes
Default export replaced with named exports:
- import useIsMountedRef from 'use-is-mounted-ref';
+ import { useIsMountedRef } from 'use-is-mounted-ref';📦 Installation
npm install use-is-mounted-ref@2.0.0
# or
yarn add use-is-mounted-ref@2.0.0📝 Full Changelog
- Add
useAbortControllerhook for automatic abort on unmount - Convert from default export to named exports (BREAKING)
- Add CHANGELOG.md
- Update README with examples and migration guide
- Full test coverage (100%)
See CHANGELOG.md for details.
Full Changelog: v1.5.0...v2.0.0