[React Native Examples] Setup Working Place for React Native Developer

[React Native Examples] Setup Working Place for React Native Developer

Post Date : 2024-03-28T08:51:55+07:00

Modified Date : 2024-03-28T08:51:55+07:00

Category: cheatsheet react-native-examples

Tags: react-native

Forewords

What is React Native?

image

Technical View

Views

JSX Components are compiled to Native Views, not the javascript logic code.

image

Components are compiled

image

image

What about JS Logic Code?

image

Expo CLI vs React Native CLI

image

Conclusion:

  • You can start with expo cli because of easy working flow and less setup
  • With expo, you can test with native functions like camera with devices more easier.
  • You can always switch from expo cli to react native cli just by using “eject”
  • With React Native CLI setup, you can mix between js code and platform native code, such as: kotline or swift
  • React Natve CLI required more setup

Setup working environment

Install Android Studio

  • Download the latest Android Studio version at official link
  • Then you can create a new virtual device(which will be used to run for testing your React Native app)

image

And you get this virtual device on your screen

image

Create new React Native project with expo

npx create-expo-app rn2024
cd rn2024
npm i
npm run start

image

As you can see, if you wanna run on your virtual devices, just press “a”. Make sure you start your virtual device first. You can check list of your android devices like this

adb list
# You may see something like this
# List of devices attached
# emulator-5554   device

image

And this is how your app display in virtual device

image