I
I
Inveker2020-05-07 00:22:59
React
Inveker, 2020-05-07 00:22:59

Why does React do this?

Why do React components (function and class) 'render' 2 times before rendering or other update?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
abberati, 2020-05-07
@Inveker

I'll play Wang. Most likely you have wrapped the component in StrictMode and are in the development environment. In this case, the components will be rendered twice when mounted to perform internal StrictMode checks.
https://github.com/facebook/react/issues/15074#iss...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question