Description #
React Native is an open-source framework developed by Facebook for building native mobile apps using JavaScript and React. It allows developers to write mobile applications that run on both iOS and Android with a single codebase while delivering native performance.
History #
React Native was released in 2015 as a way to leverage React’s declarative UI model for mobile app development. It evolved from Facebook’s internal hackathons and projects and quickly gained popularity due to its efficiency and cross-platform capabilities.
Hello World Code #
import React from 'react';
import { Text, View } from 'react-native';
export default function App() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Hello, World!</Text>
</View>
);
}
How to Run #
Option 1: Online
Try React Native in Expo Snack.
Option 2: Local
- Install Node.js and npm
- Install Expo CLI:
bashCopynpm install -g expo-cli
- Create a new project and run:
expo init HelloWorld
cd HelloWorld
expo start
Key Concepts #
- Uses JavaScript and React paradigm for UI
- Cross-platform: iOS and Android support
- Provides native components for better performance
- Supports hot reload for fast development
- Access to device APIs via native modules
- Large ecosystem and third-party libraries
- Integration with Expo for simplified workflows
- Modular architecture with reusable components
- Supports navigation, gestures, and animations
- Strong community and corporate support
Try It Online #
Fun Facts #
- React Native powers popular apps like Facebook, Instagram, and Discord.
- It bridges JavaScript and native code for seamless user experiences.
- The framework encourages code reuse and rapid prototyping.
- Expo simplifies building and deploying React Native apps without native toolchains.
- React Native supports building apps with fully native UI components rather than webviews.