What is the difference between development and production builds in React Native?
Answer
Development builds and production builds differ significantly in React Native: Development build: includes extra debugging code; JS runs unminified with source maps; JavaScript runs in Debug mode (connected to Chrome DevTools or Hermes debugger); __DEV__ is true; PropTypes warnings enabled; Redux DevTools work; Hot Refresh works; connects to Metro bundler on your computer; slower performance (JS not optimized, extra checks); larger bundle size; can use console.log() effectively. Production build: JavaScript is minified and optimized; __DEV__ is false (PropTypes checks skipped); Hermes engine compiles JS to bytecode at build time (faster startup); no connection to Metro — bundle embedded in the app binary; significantly faster performance; smaller app size; no source maps in app. Building for production: iOS: npx react-native run-ios --configuration Release or use Xcode → Product → Archive; Android: cd android && ./gradlew assembleRelease. __DEV__ global: if (__DEV__) { console.log("Debug info"); // Only runs in dev } // Common pattern: if (__DEV__) { const DevMenu = require("./DevMenu"); }. Code stripping: dead code elimination can remove __DEV__ blocks in production, reducing bundle size. Hermes (bytecode compilation): Hermes pre-compiles JS to bytecode during the build (not at runtime) — dramatically improves Time to Interactive (TTI) in production. Enabled by default for new React Native projects.