React Native & Expo for Beginners / Chapter 1 — How It Differs from React on the Web (lessons 1–5) / Lesson 1

What Is React Native? (A Map for People Who Know React)

Time needed: about 4 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

React was always able to choose its "render target"

React itself (the react package) contains no screen-drawing features at all.

All it has are hooks, elements, and the re-rendering machinery; what actually puts the result on screen is a separate package called a renderer.

The react-dom you used on the web is one such renderer, and React Native is another renderer that sits in the same spot.

Same React, new target (App.web.jsx and App.native.jsx)

// Web (react-dom) import { useState } from 'react' export default function App() { const [count, setCount] = useState(0) return ( <div> <p>Likes: {count}</p> <button onClick={() => setCount(count + 1)}>Like</button> </div> ) } // React Native (react-native) -- hooks and JSX are unchanged. Only the tags and props differ import { useState } from 'react' import { Text, View, Pressable } from 'react-native' export default function App() { const [count, setCount] = useState(0) return ( <View> <Text>Likes: {count}</Text> <Pressable onPress={() => setCount(count + 1)}> <Text>Like</Text> </Pressable> </View> ) }

All you relearn are "components" and "styles"

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.