Performance Optimization
FlatList optimization, memo, useMemo/useCallback, Hermes, profiling, bundle size
1What is the main role of React.memo in React Native performance optimization?
What is the main role of React.memo in React Native performance optimization?
Odpowiedź
React.memo is a Higher-Order Component that memoizes the render result of a functional component. It prevents unnecessary re-renders by comparing current props with previous ones (shallow comparison by default). If props haven't changed, React reuses the memoized result instead of re-rendering the component, which significantly improves performance in lists or complex component trees.
2Which FlatList property significantly optimizes scrolling by providing item dimensions in advance?
Which FlatList property significantly optimizes scrolling by providing item dimensions in advance?
Odpowiedź
getItemLayout is an optional FlatList property that allows pre-calculating the height, width, and offset of each item. This prevents React Native from dynamically measuring each item, which considerably improves scroll performance, especially when jumping to a specific index with scrollToIndex. This optimization is particularly useful when all items have the same size.
3What is the main difference between useMemo and useCallback in terms of optimization?
What is the main difference between useMemo and useCallback in terms of optimization?
Odpowiedź
useMemo memoizes the result of an expensive calculation and returns that computed value, while useCallback memoizes a function itself and returns that function. useMemo is useful for avoiding heavy recalculations on each render, whereas useCallback is essential for avoiding recreating functions passed as props to memoized child components, which would break their React.memo optimization.
What is Hermes and what is its main advantage for React Native applications?
Why is it crucial to provide a stable keyExtractor function to FlatList?
+21 pytań z rozmów
Inne tematy rekrutacyjne React Native
JavaScript Essentials
React Fundamentals
React Native Basics
React Hooks
TypeScript for React & React Native
React Native Components & API
React Native Styling & Layout
React Native Navigation
React Native State Management
React Native Networking & API
Data Persistence
Forms & Validation
React Native Animations
Native Modules & Bridge
Platform-Specific Code
Permissions & Device APIs
Push Notifications
React Native Testing
React Native Debugging
Build & Deployment
Expo vs React Native Bare
Memory Management
Architecture Patterns
React Native New Architecture
Security Best Practices
Offline-First Architecture
React Native CI/CD
Monorepo & Code Sharing
Advanced Topics
App Lifecycle & Background Execution
Authentication & Session Management
Monitoring & Crash Reporting
Opanuj React Native na następną rozmowę
Uzyskaj dostęp do wszystkich pytań, flashcards, testów technicznych, ćwiczeń code review i symulatorów rozmów.
Zacznij za darmo