Pretty sure its been doing this in dev mode since 0.14. Maybe earlier...
I’d never seen the behaviour before (but had never explicitly used strict mode - to be honest I didn’t know it existed!) and switching between React 17 and 18 was enough to make it happen, so I assumed that was the responsible change, but actually it’s a bit more subtle.
Thought it might be useful to share for people who are using Next.js anyway, as for me it just started happening when I created a new project with no explanation which led to me thinking I was losing it for a while, lol.
https://reactjs.org/blog/2022/03/29/react-v18.html#new-stric...