Skip to content

Why loading page twice? #2056

Answered by code-flu
tinternet asked this question in Q&A
Discussion options

You must be logged in to vote

When wrapped with React.StrictMode (which is how [CRA template] are setup), on development, renders will be called twice. This is done to catch bugs that might occurs when some setState functions are not pure. You can read this for more detail.

Solutoin - Remove React.StrictMode from src/index.tsx

https://stackoverflow.com/questions/61193122/react-default-create-react-app-app-component-rendered-twice

Replies: 9 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by koistya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
8 participants
Converted from issue

This discussion was converted from issue #139 on September 14, 2023 22:12.