ReactIntermediate#effects#debugging

What is StrictMode and why does my effect run twice?

In development StrictMode intentionally mounts, unmounts and remounts components to surface missing cleanup and impure logic. It does not happen in production builds.

Example
<StrictMode><App /></StrictMode>
// effect runs twice in dev — add proper cleanup instead of removing StrictMode

Related Questions

1
ReactAdvanced#state#patterns

How do you share state between distant components?

Open
2
ReactAdvanced#state#data

What is the difference between server state and client state?

Open
3
ReactIntermediate#state

Why should you not mutate state directly?

Open