📱 React Native Intermediate

What are Native Modules in React Native?

Why Interviewers Ask This

Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.

Answer

Native Modules allow JavaScript to call native platform code (Swift/Objective-C on iOS, Kotlin/Java on Android). Used when React Native doesn't provide a built-in API for a device feature or when you need a performance-critical native implementation. When to use native modules: accessing hardware (Bluetooth, NFC), integrating third-party SDKs (analytics, payment SDKs), CPU-intensive operations (image processing, encryption), features not yet in React Native core. Old Architecture native module (iOS — Objective-C): // MyModule.h: @interface MyModule : NSObject <RCTBridgeModule> @end // MyModule.m: @implementation MyModule RCT_EXPORT_MODULE(); RCT_EXPORT_METHOD(greet:(NSString *)name resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { NSString *greeting = [NSString stringWithFormat:@"Hello, %@!", name]; resolve(greeting); } @end // JavaScript: import { NativeModules } from "react-native"; const { MyModule } = NativeModules; const greeting = await MyModule.greet("Alice");. New Architecture TurboModule: uses JSI for synchronous calls and TypeScript specifications for type safety. Community modules: thousands of pre-built native modules on npm — react-native-camera, react-native-maps, react-native-bluetooth, etc. Always check before writing your own. Expo modules API: Expo provides a cleaner API for writing native modules with Swift/Kotlin, strongly typed, works with both old and new architecture.

Pro Tip

Back up your answer with a specific project or situation. Saying 'In my last React Native project, I used this when...' immediately makes your answer more credible and memorable.