React·100 questions

What is StrictMode and why can effects be called twice in dev?

Answer
StrictMode enables additional checks in dev.
It may run effects twice to detect bugs.
This does not happen in production.
Write effects to be idempotent and with cleanup.
Do not use StrictMode as a bug in production.
Was this answer helpful?

More questions in this topic

Related questions from other topics