reactjsbuildstrict-mode

do I have to remove <React.StrictMode> before creating build file?


I want to create build file for my react app, and I don't want components to render in it two time, so do I have to remove <React.StrictMode> before running following command:

npm run build


Solution

  • You don't need to remove React.StrictMode after you use npm run build. React disables the strict modes for your production build.

    Although the Strict Mode checks only run in development, they help you find bugs that already exist in your code but can be tricky to reliably reproduce in production. Strict Mode lets you fix bugs before your users report them.

    https://react.dev/reference/react/StrictMode