Apa Itu React Native?
React Native adalah framework untuk membangun aplikasi mobile native menggunakan JavaScript dan React. Dikembangkan oleh Facebook, React Native memungkinkan developer membuat aplikasi iOS dan Android dari satu codebase dengan performa native. React Native menggunakan komponen native (bukan WebView) sehingga performanya mendekati native.
Mengapa React Native?
- Single Codebase – Satu kode untuk iOS dan Android
- React Knowledge – Gunakan skill React yang sudah ada
- Hot Reload – Lihat perubahan secara instan
- Native Performance – Komponen native, bukan WebView
- Huge Ecosystem – npm packages, community
- Corporate Adoption – Facebook, Instagram, Airbnb, Discord
React Native vs Flutter
| Aspek | React Native | Flutter |
|---|---|---|
| Bahasa | JavaScript/TypeScript | Dart |
| Rendering | Native components | Custom rendering engine |
| Hot Reload | Ya | Ya (lebih cepat) |
| Performance | Near-native | Near-native |
| UI Consistency | Platform-specific | Consistent across platforms |
| Learning Curve | Rendah (jika tahu React) | Sedang (perlu belajar Dart) |
| Ecosystem | Sangat besar (npm) | Besar (pub.dev) |
Roadmap Belajar React Native
Level 1: Beginner
- Setup – Node.js, React Native CLI, Android Studio, Xcode
- Core Components – View, Text, Image, ScrollView, FlatList
- Styling – StyleSheet, Flexbox, responsive design
- Navigation – React Navigation (Stack, Tab, Drawer)
- State – useState, useContext
- Platform-Specific – Platform.OS, Platform.select
Level 2: Intermediate
- Networking – Fetch, Axios, REST API integration
- Storage – AsyncStorage, MMKV, SQLite
- Forms – Formik, React Hook Form, validation
- Animations – Animated API, Reanimated
- Native Modules – Bridging to native code
- Push Notifications – Firebase Cloud Messaging
Level 3: Advanced
- State Management – Redux, Zustand, Recoil
- Performance – FlatList optimization, memo, useMemo
- Testing – Jest, Detox, React Native Testing Library
- TypeScript – Typing props, navigation, API
- Deep Linking – Universal links, app links
Level 4: Expert
- Native Development – Swift, Kotlin native modules
- CI/CD – Fastlane, CodePush, App Center
- App Store – Deployment, review process
- Performance Profiling – Flipper, React DevTools
Contoh Kode React Native
import React, { useState, useEffect } from 'react';
import {
View, Text, FlatList, TouchableOpacity,
StyleSheet, ActivityIndicator
} from 'react-native';
const App = () => {
const [data, setData] = useState([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
fetchProducts();
}, []);
const fetchProducts = async () => {
try {
const response = await fetch('https://api.example.com/products');
const json = await response.json();
setData(json);
} catch (error) {
console.error(error);
} finally {
setLoading(false);
}
};
if (loading) {
return (
);
}
return (
Daftar Produk
item.id.toString()}
renderItem={({ item }) => (
{item.nama}
Rp {item.harga.toLocaleString()}
)}
/>
);
};
const styles = StyleSheet.create({
container: { flex: 1, padding: 16, backgroundColor: '#f5f5f5' },
center: { flex: 1, justifyContent: 'center', alignItems: 'center' },
title: { fontSize: 24, fontWeight: 'bold', marginBottom: 16 },
card: {
backgroundColor: 'white', padding: 16,
borderRadius: 8, marginBottom: 8,
shadowColor: '#000', shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1, elevation: 2
},
name: { fontSize: 16, fontWeight: '600' },
price: { fontSize: 14, color: '#666', marginTop: 4 }
});
export default App;
Tips Belajar React Native
- Pelajari React dulu – React Native adalah React untuk mobile
- Pahami Flexbox – Layout di React Native berbeda dari web
- Gunakan Expo untuk mulai – Lebih mudah setup
- Test di device nyata – Emulator tidak cukup
- Pelajari native modules – Untuk fitur yang tidak tersedia
- Baca React Native Docs – reactnative.dev
Tools yang Dibutuhkan
| Tool | Deskripsi |
|---|---|
| Node.js & NPM | Runtime dan package manager |
| React Native CLI / Expo | Framework toolchain |
| Android Studio | Android SDK dan emulator |
| Xcode | iOS development (Mac only) |
| VS Code | Code editor |
| Git | Version control |
Kesimpulan
React Native adalah pilihan excellent untuk developer yang sudah menguasai React dan ingin membangun aplikasi mobile. Dengan single codebase dan native performance, React Native membuka peluang karir yang luas.
“React Native combines the best parts of native development with React.” – Facebook




