React Native is an open-source framework for building native mobile applications using JavaScript and React. It allows developers to use the same codebase for iOS and Android platforms.
React Native Anti-Patterns Overview
Inefficient List Rendering
ScrollView
with map
for long lists leads to performance issues as it renders all items at once. Use FlatList
or SectionList
for efficient list rendering with windowing and recycling.Not Using React Native's PureComponent or memo
React.memo
for functional components or PureComponent
for class components to prevent unnecessary re-renders.Layout Thrashing
useNativeDriver
when possible.Not Using useCallback for Event Handlers
useCallback
to memoize functions.Inline Styles
StyleSheet.create()
to define styles outside the component.Not Using Proper Image Optimization
resizeMode
.Not Using React Navigation Properly
Not Handling Platform Differences Properly
Platform.select()
or platform-specific files (e.g., Component.ios.js
and Component.android.js
).Not Using Proper State Management
Not Handling Permissions Properly
Not Using Proper Error Boundaries
Not Using Proper Accessibility Features
accessible
, accessibilityLabel
, and accessibilityHint
.Not Optimizing App Launch Time
AppLoading
component.Not Using Hermes Engine