Why your useEffect is firing twice in React 18
React 18 has been out for about 8 months now and it contains a ton of goodies for both end-users and library authors. However, there is one new change that seems to keep coming up in GitHub issues and forum posts --
useEffect now fires twice under Strict Mode in development. In this post, I'll briefly go over exactly what Strict Mode in React is and then offer some advice on dealing with the change -- as well as a few
useEffect best practices.