Lesson 3 of 60 – React Native vs React
5%

React Native vs React

React and React Native are closely related technologies, but they are used for different types of application development. React is mainly used for building web user interfaces, while React Native is used for building mobile applications.

Note: React Native uses many important React concepts such as components, props, state and Hooks. Therefore, React knowledge provides a strong foundation for learning React Native.

1. What is React?

React is a JavaScript library used for building user interfaces, especially web interfaces.

It allows developers to create reusable components and manage interactive user interfaces.

2. What is React Native?

React Native is a framework for building mobile applications using JavaScript and React concepts.

It provides mobile-specific components and APIs for creating applications for platforms such as Android and iOS.

3. Main Difference

The main difference is the target platform.

Technology Main Use
React Web applications
React Native Mobile applications

4. React for Web Development

React is commonly used to create websites and web applications.

function App() {
    return (
        <div>
            <h1>Hello React</h1>
            <p>Welcome to my website</p>
        </div>
    );
}

5. React Native for Mobile Development

React Native uses mobile components to create interfaces for mobile applications.

function App() {
    return (
        <View>
            <Text>Hello React Native</Text>
        </View>
    );
}

6. HTML Elements in React

React web applications commonly use HTML elements such as div, h1, p and button.

<div>
    <h1>Welcome</h1>
</div>

7. Components in React Native

React Native uses components such as View, Text, Image and TextInput.

<View>
    <Text>Welcome</Text>
</View>

8. React and JSX

React uses JSX to describe web user interfaces.

function App() {
    return <h1>Hello React</h1>;
}

JSX looks similar to HTML, but it is used within JavaScript code.

9. React Native and JSX

React Native also uses JSX.

function App() {
    return (
        <View>
            <Text>Hello Mobile App</Text>
        </View>
    );
}

The important difference is the components used inside JSX.

10. Styling in React

React web applications can use CSS, CSS Modules, styled-components and other styling approaches.

.title {
    color: blue;
}

11. Styling in React Native

React Native has its own styling system. The StyleSheet API is commonly used to define styles.

const styles = StyleSheet.create({
    title: {
        color: "blue",
        fontSize: 24
    }
});

12. CSS Properties Are Different

React Native styling uses JavaScript objects and many style property names differ from traditional CSS syntax.

const styles = StyleSheet.create({
    title: {
        fontSize: 24,
        marginTop: 20
    }
});

For example, React Native commonly uses fontSize instead of the CSS-style property font-size.

13. Components Are Similar

Both React and React Native use reusable components.

A component can contain its own JSX, logic, state and event handling.

function Welcome() {
    return <Text>Welcome</Text>;
}

14. Props Work Similarly

Props are used in both React and React Native to pass data from a parent component to a child component.

function Student({ name }) {
    return (
        <Text>{name}</Text>
    );
}

15. State Works Similarly

Both React and React Native can use the useState Hook to manage component state.

const [count, setCount] = useState(0);

The state can be updated when users interact with the application.

16. Hooks Are Used in Both

React Hooks such as useState, useEffect, useRef and useContext can also be used in React Native applications.

This is one reason React knowledge is useful when learning React Native.

17. Event Handling

Both technologies respond to user interactions, but the event components and APIs can differ.

For example, React web applications commonly use onClick, while React Native commonly uses events such as onPress.

<Pressable onPress={() => alert("Pressed")}>
    <Text>Press Me</Text>
</Pressable>

18. Navigation

React web applications commonly use routing libraries for navigation between web pages or views.

React Native applications commonly use mobile navigation solutions such as React Navigation to move between screens.

19. React Runs in the Browser

A React web application normally runs in a web browser.

The browser provides the environment for displaying the web interface.

20. React Native Runs on Mobile Platforms

React Native applications are designed to run on mobile platforms such as Android and iOS.

This makes React Native suitable for mobile application development.

21. API Communication

Both React and React Native applications can communicate with backend APIs.

For example, JavaScript's fetch() or libraries such as Axios can be used to request data from a server.

fetch("https://example.com/api/students")
    .then(response => response.json())
    .then(data => console.log(data));

22. Database Communication

Neither React nor React Native normally connects directly to a database from the user interface.

A backend API can communicate with databases such as MySQL and send the required data to the application.

React Native
      ↓
   REST API
      ↓
 PHP Backend
      ↓
    MySQL

23. Device Features

React Native can interact with mobile device capabilities through appropriate APIs and libraries.

Examples include camera, location, notifications and other mobile features.

These capabilities are different from the normal browser APIs commonly used in React web applications.

24. User Interface Components

React React Native
div View
p Text
img Image
input TextInput
button Button / Pressable

25. Where React Is Commonly Used

React is commonly used for:

  • Websites
  • Web applications
  • Dashboards
  • Admin panels
  • E-commerce websites
  • Single-page applications

26. Where React Native Is Commonly Used

React Native is commonly used for:

  • Education applications
  • Business applications
  • Shopping applications
  • Booking applications
  • Student management applications
  • Service applications

27. Learning React Before React Native

Learning React before React Native can make the transition easier.

Concepts such as JSX, components, props, state, Hooks and component composition are useful in both technologies.

28. React and React Native Together

React and React Native are not competing versions of the same technology. They are used for different application platforms while sharing the React programming model.

React
  ↓
Web Applications

React Native
  ↓
Mobile Applications

29. Quick Comparison

Feature React React Native
Primary Platform Web Mobile
Language JavaScript / TypeScript JavaScript / TypeScript
UI Components HTML elements Native UI components
Styling CSS and related solutions React Native styling system
Navigation Web routing Mobile navigation
Target Web browsers Mobile platforms

30. React to React Native Learning Path

If you already know React, you can use your existing knowledge as a foundation for learning React Native.

React Basics
    ↓
JSX
    ↓
Components
    ↓
Props
    ↓
State
    ↓
Hooks
    ↓
React Native Components
    ↓
Mobile Styling
    ↓
Navigation
    ↓
APIs
    ↓
Storage
    ↓
Mobile Projects

The major new concepts are the mobile components, mobile styling, navigation and device-specific capabilities.

📌 Key Points

  • React is mainly used for building web user interfaces.
  • React Native is used for building mobile applications.
  • Both use important React concepts such as components, props and state.
  • React commonly uses HTML elements for web interfaces.
  • React Native provides mobile-specific components.
  • React web applications commonly use CSS for styling.
  • React Native provides its own styling system.
  • React uses web routing solutions, while React Native commonly uses mobile navigation.
  • Both can communicate with backend APIs.
  • React knowledge provides a strong foundation for learning React Native.

🧠 Quick Quiz

Question: What is the main difference between React and React Native?