Categories
JavaScript Answers

How to fix function being called twice in React?

Spread the love

To fix function being called twice in React, we disable strict mode.

For instance, if we have

<React.StrictMode>
  <App />
</React.StrictMode>

then we disable strict mode by removing the React.StrictMode component from the code.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *