Home > Software engineering >  React showing twice message in console web browser
React showing twice message in console web browser

Time:11-27

I'm currently just started lerning React following Udemy course. When I run my code. I was wondering why these message showing twice in console web browser. Thank you.Out put

Why it doesn't show only once of output? Thank you.

CodePudding user response:

I believe you are using React 18 with Strict Mode enabled.

Your component renders twice on mount because of this.

It is a development feature intended to re-mount your components in order to spot unexpected side-effects.

CodePudding user response:

This happen because of react strict ( only in dev mode ) to avoid doc for react strict mode

  • Related