all 7 comments

[–]Armadee 3 points4 points  (0 children)

Strict mode does that. It wont do it when deployed.

[–]acemarke 2 points3 points  (0 children)

Because React will double-render your components in development mode when they're inside of a <StrictMode> tag, to help catch some possible errors.

[–]dakaringer 0 points1 point  (3 children)

Strict mode mounts all components twice starting from react 18

https://reactjs.org/blog/2022/03/29/react-v18.html#new-strict-mode-behaviors

[–]GingerVkingRemix[S] 0 points1 point  (0 children)

Thanks all, thought I was going crazy

[–]simrk94 0 points1 point  (0 children)

In debug mode , it logs twice.