Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

whats the real diff between "create-react-native-app myproject" and "react-native init myproject"

I've recently started react native and following guide on tutorial there are 2 option one is create the project via "create-react-native-app myproject" and other one is "react-native init myproject".

the first one(create-react-native-app) generates app.js only whereas other one generates index.android.js and index.ios.js..

I know somehow they are doing same job but whats the real diffirence here ? which one should I pick to start and when the other one is more usefull over?

like image 230
TyForHelpDude Avatar asked Aug 20 '17 13:08

TyForHelpDude


People also ask

Which is better React Native or native application development?

In Native application development, each and every screen is designed individually for both Android and iOS devices, which results in higher mobile app UI/UX experience. So, the winner of React Native vs Native apps development in terms of exceptional mobile app experience is the latter.

What does create react app actually do?

Create React App (CRA) is a tool to create single-page React applications that is officially supported by the React team. The script generates the required files and folders to start the React application and run it on the browser.

Does React Native create native apps?

Create native apps for Android and iOS using React React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces.

Is create react app the best?

As per the official documentation site: Create React App is a comfortable environment for learning React, and is the best way to start building a new single-page application in React.


1 Answers

The create-react-native-app ("CRNA") CLI builds a project template based on Expo, a third-party toolkit which allows you to write cross-platform React Native applications using only JavaScript, and provides a smoother workflow for getting the app running on a real device. In addition, Expo provides access to tons of native APIs, for which you'd normally need libraries or custom native code.

Expo is great, and in an ideal world, it is what most app developers would probably prefer to use, but Expo's architecture sets an unfortunate limitation: You cannot write custom Native Modules, or integrate third-party libraries which depend on custom native code that isn't build into Expo. This means you have only access to the native functionality provided by React Native and Expo, and cannot easily extend it.

By contrast, the react-native CLI's init command creates a plain React Native app template, with native iOS and Android projects you can modify. The downside of this approach is that you'll need to set up the native iOS and Android build chains on your computer, and it's significantly more cumbersome to get started developing and deploying your app.

Luckily, Expo provides a way to detach a CRNA app from their native app shell. This will convert a CRNA project into something similar to the plain project created by react-native init, but with access to all the Expo SDK functionality.

In practice, the best approach for most beginners and new projects is to start with create-react-native-app, and evaluate whether you'll need to detach later. Expo provides a handy guide to help making that decision.

like image 174
jevakallio Avatar answered Oct 06 '22 01:10

jevakallio