Skip to content

Commit d23e00c

Browse files
committed
Improve STRICT_MODE docs
1 parent 966f5bf commit d23e00c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

contributingGuides/STRICT_MODE.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ Only use this flag for local development and testing, but do not make it dependi
3030
- every component will go through: `mount -> unmount -> mount` on first app render
3131
- any code running inside `useEffect(() => {...}, [])` that would be expected to run once on initial render, will run twice, this might include initial api calls
3232

33-
sources:
33+
#### Example: How StrictMode Affects AuthScreen
34+
In AuthScreen, we have a typical pattern where certain logic is executed during mounting and unmounting, this is what happen after a refresh:
35+
- Mounting: it runs `ReconnectApp`.
36+
- Unmounting: AuthScreen cleans up data.
37+
- Re-mounting Due to StrictMode: This behavior will cause `OpenApp` to be executed on the new mount.
38+
39+
Impact: This double execution could lead to unnecessary API calls or unexpected states.
40+
41+
Sources:
3442
- [StrictMode docs](https://react.dev/reference/react/StrictMode)
3543
- [StrictMode recommended usage](https://react.dev/reference/react/StrictMode)
3644
- [Original PR introducing this feature](https://github.com/Expensify/App/pull/42592)

0 commit comments

Comments
 (0)