reach / router

https://reach.tech/router
MIT License
6.91k stars 326 forks source link

Fix `this.unmounted` being true when re-mounted by React 18 #480

Open dralletje opened 2 years ago

dralletje commented 2 years ago

I understand that you are spending your time now on React Router v6, but it would be very nice to have this in still. This one line change made my app go from "Reach Router not doing anything at all" to working perfectly on React 18.

React 18 can render componentWillUnmount and then componentDidMount the same instance that was just "willUnmount"-ed. This makes sure we reset this.unmounted = false when re-didMount-ing.