Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why do two identical outputs occur in the console?

Two identical outputs occur in my project with React

Code enter image description here

Output enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

How do I get it to be a single output

>Solution :

In development mode, React will call your components & effects twice to determine potential bugs. Nothing to worry about.
This behaviour comes from <React.StrictMode/>.
You can check out the documentation here.
If you want to render once, find the root component of your app (generally App.js) and remove the React.StrictMode wrapper.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading