[hooks] useEffectAfterMount does not in React 18's strict mode in development environment
useEffectAfterMount does not in React 18's strict mode in development environment, because react first mounts component, which sets isMounted.current to true, then unmounts component and mounts again. The problem is that isMounted.current is true on second mount.
Solution - reset isMounted.current on unmount.
@ArtemGolovko
The fact that react 18 strict mode behaviour breaks this hook makes me think that this hook shouldn't even exist. It's a hack to begin with since I created this to deal with next/router having undefined data query params on first render.
Having isMounted false after unmount may cause other issues. useEffect's clean-up runs after the next render, before the next useEffect. This means it will be reset to false on every render. causing the effect to never execute.
I will be marking this hook as deprecated for the next release and remove it later on a major release.