ReactJS là thư viện JavaScript render ra DOM trong browser, output là HTML/CSS. React Native là framework dùng cùng model component + JSX nhưng render ra native UI components (UIView trên iOS, ViewGroup/Android.View trên Android), không có DOM, không có HTML tag.
Khác biệt cụ thể:
- Tag: Web dùng <div>/<p>/<button>; RN dùng <View>/<Text>/<Pressable>. Mọi text bắt buộc nằm trong <Text> — viết text trần trong <View> là crash.
- Style: Web dùng CSS file/inline với units px/rem/%; RN dùng StyleSheet.create() với object JS, đơn vị là DIP (density-independent pixels), không có cascading, không có display: block/inline, default flexDirection: column.
- Routing: Web dùng react-router/Next.js; RN dùng react-navigation (stack/tab/drawer).
- Build: Web build ra HTML+JS bundle; RN build ra binary .ipa/.apk qua Metro bundler + native toolchain (Xcode/Gradle).
- API: RN có thêm Platform, Dimensions, AppState, AsyncStorage, không có window/document.
Điểm chung: hooks, JSX, component composition, props/state, context — code logic gần như copy-paste được.
ReactJS is a JavaScript library that renders to the DOM in a browser — output is HTML/CSS. React Native is a framework that reuses the same component model + JSX but renders to native UI components (UIView on iOS, ViewGroup/Android.View on Android). No DOM, no HTML tags.
Concrete differences:
- Tags: web uses <div>/<p>/<button>; RN uses <View>/<Text>/<Pressable>. Every piece of text must sit inside <Text> — bare text in a <View> crashes.
- Style: web uses CSS with px/rem/%; RN uses StyleSheet.create() with JS objects in DIPs, no cascading, no display: block/inline, and flexDirection defaults to column.
- Routing: web uses react-router/Next.js; RN uses react-navigation.
- Build: web ships HTML+JS bundles; RN ships binary .ipa/.apk via Metro + native toolchain.
- APIs: RN adds Platform, Dimensions, AppState, AsyncStorage, and has no window/document.
What is shared: hooks, JSX, component composition, props/state, context — most logic copy-pastes.