antonioru / beautiful-react-hooks

🔥 A collection of beautiful and (hopefully) useful React hooks to speed-up your components and hooks development 🔥
https://antonioru.github.io/beautiful-react-hooks/
MIT License
8.17k stars 577 forks source link

:memo useWillUnmount should called useUnmount #414

Closed little-buddy closed 1 year ago

little-buddy commented 1 year ago

https://github.com/antonioru/beautiful-react-hooks/blob/519ebf1c7dd3fa01f25cd2e4258495280d415cd3/src/useWillUnmount.ts#L9-L25

By React doc for useEffect

After your component is removed from the DOM,
React will run your cleanup function.

So it should called useUnmount

antonioru commented 1 year ago

@little-buddy agree, feel free to open a PR

little-buddy commented 1 year ago

@antonioru awesome!