DEV Community

loading...
Cover image for Create your first React Native app with react-native cli as a beginner.

Create your first React Native app with react-native cli as a beginner.

gautham495 profile image Gautham Vijayan ・2 min read

As expo bloats our app with unnecessary dependencies, we will be looking at react-native cli to create a bare-bones react native app.

A simple "Hello World" app is 25 mb in size when made with expo. So we are going to look at the alternative for it.

This post is a part of the react-native series I am currently writing on.

Now go to your terminal and type the below code,


npx react-native init Project

Enter fullscreen mode Exit fullscreen mode

There is no need to install react native cli globally like expo cli as said in its documentation.

Now go into the project folder.


cd Project

Enter fullscreen mode Exit fullscreen mode

You can now run and build the app for your own operating system with the following command.


npx react-native run-android

npx react-native run-ios


Enter fullscreen mode Exit fullscreen mode

You can plug in your device and enable usb debugging as said in this website aboutreact to run your built app on you physical device directly,

Or you can use an emulator to run your app.

That's how you can create your first react-native app without expo cli and build and run it on your android/iOS emulator or in a physical device.

In my next post I will discuss about the React Native elements like View, Text etc.,

Thank you for reading!!

Check out my portfolio: Gautham's portfolio

Check out my blog: coding-magnified.tech

My Other Articles:

Discussion (7)

Collapse
dzetah profile image
Stanyslas Bres

Hey, you’re saying it’s 25Mb with expo, but what’s the size with react-native CLI ?

Collapse
gautham495 profile image
Gautham Vijayan Author

Its less than 5-10 mb for a "Hello world app" for react native cli app

Collapse
dzetah profile image
Stanyslas Bres

I’m not judging expo or RN CLI, but it’s good to know that the size of the app is so much bigger with expo. Thanks 😊

Thread Thread
gautham495 profile image
Collapse
gautham495 profile image
Gautham Vijayan Author

Expo is for people who have literally no knowledge about react native or mobile app development.

So it would be better if you start with it first.

But for production, react native cli is must!!

Collapse
varghesejose2020 profile image
Varghese Jose

react-native run-android
Will work?

Collapse
gautham495 profile image
Gautham Vijayan Author

Naa bro. in docs its given like it and I use the same thing said in the post.

Forem Open with the Forem app