A comprehensive React Native project designed to help you prepare for mobile engineering interviews
This project demonstrates key React Native concepts and patterns that are commonly discussed in mobile engineering interviews. It covers everything from basic component architecture to advanced performance optimization techniques.
- Component Architecture: Functional components, class components, and component lifecycle
- Hooks: useState, useEffect, useCallback, useMemo, useRef, useContext, and custom hooks
- State Management: Local state, Context API, and global state patterns
- Navigation: Stack, tab, and nested navigation with React Navigation
- Styling: StyleSheet, dynamic styling, and responsive design
- Performance Optimization: FlatList optimization, React.memo, lazy loading
- Native Modules: Platform-specific code and bridging concepts
- Device Features: Permissions, location, camera, and device information
- Platform Differences: iOS vs Android specific implementations
- Async Operations: API calls, promises, and async/await patterns
- Custom Hooks: Reusable logic patterns
- Memoization: Performance optimization techniques
- Context Patterns: State management without Redux
- Platform Detection: Conditional rendering and platform-specific code
- Error Handling: Graceful error handling and fallbacks
- Node.js (v16 or higher)
- npm or yarn
- Expo CLI
- Xcode (for iOS development)
- Android Studio (for Android development)
- Watchman (for file watching)
- JDK 17 (for Android development)
-
Clone and install dependencies:
cd rn-interview-playground npm install -
Start the development server:
npm start
-
Run on iOS:
npm run ios
-
Run on Android:
npm run android
The app uses a bottom tab navigator with the following screens:
- Home: Overview of all interview topics
- Components: React fundamentals and component patterns
- Performance: Optimization techniques and performance monitoring
- Native: Native modules and platform-specific features
- State management with hooks
- Controlled components
- Conditional rendering
- Event handling
- Component lifecycle
- Custom hooks examples
- useCallback and useMemo optimization
- useRef for DOM manipulation
- Context API implementation
- Async operations with hooks
- FlatList optimization
- React.memo implementation
- Callback memoization
- Large dataset handling
- Performance monitoring
- Platform detection
- Native module concepts
- Bridging JavaScript and native code
- Platform-specific implementations
- Device information retrieval
- Permission handling
- Location services
- Camera access
- Platform-specific features
- Component lifecycle methods
- Functional components and hooks
- State management approaches
- Props and prop drilling
- Context API usage
- Event handling patterns
- FlatList vs ScrollView
- React.memo and useMemo
- useCallback optimization
- Image optimization
- Bundle size optimization
- Memory leak prevention
- Stack navigation
- Tab navigation
- Nested navigation
- Deep linking
- Navigation state management
- Platform-specific code
- Native module creation
- Bridging concepts
- Permission handling
- Device feature access
- Debugging tools
- Console logging
- Error boundaries
- Performance monitoring
- Screen dimensions
- Safe areas
- Device orientation
- Platform differences
- App lifecycle
- Q: What's the difference between functional and class components?
- A: See
ComponentsScreen.tsxfor functional component examples with hooks
- Q: When would you use Context vs Redux?
- A: Context example in
HooksScreen.tsxwith theme switching
- Q: How do you optimize FlatList performance?
- A: See
PerformanceScreen.tsxfor optimization techniques
- Q: When would you create a native module?
- A: See
NativeModulesScreen.tsxfor bridging concepts
- Q: How do you handle iOS vs Android differences?
- A: See platform-specific code examples throughout the app
// Custom hook example
const useCounter = (initialValue: number = 0) => {
const [count, setCount] = useState(initialValue);
const increment = useCallback(() => setCount(c => c + 1), []);
const decrement = useCallback(() => setCount(c => c - 1), []);
return { count, increment, decrement };
};// Memoized component
const OptimizedComponent = React.memo(({ data, onPress }) => {
const processedData = useMemo(() => {
return data.map(item => item.toUpperCase());
}, [data]);
return (
<FlatList
data={processedData}
renderItem={({ item }) => <Item onPress={onPress} />}
keyExtractor={(item) => item.id}
getItemLayout={(data, index) => ({ length: 50, offset: 50 * index, index })}
/>
);
});if (Platform.OS === 'ios') {
// iOS-specific implementation
} else {
// Android-specific implementation
}- React Native: Mobile app framework
- Expo: Development platform
- TypeScript: Type safety
- React Navigation: Navigation library
- React Hooks: State management
- Context API: Global state
- Expo modules: Device features
- Run the app and explore each screen
- Read the code to understand implementation patterns
- Modify examples to test your understanding
- Practice explaining the concepts out loud
- Review performance optimizations
- Understand platform differences
To make this production-ready:
- Add comprehensive error handling
- Implement proper testing (Jest, Detox)
- Add state management (Redux Toolkit)
- Implement proper navigation types
- Add proper logging and analytics
- Set up CI/CD pipeline
- Add proper app icons and splash screens
This playground covers the most common React Native interview topics. Make sure to run through each example and understand the underlying concepts. Remember to explain your thought process during the interview and be ready to discuss trade-offs and alternative approaches.
Built with β€οΈ for React Native interview preparation