Getting Started with React Native JS Framework | SitePen

What is React Native

React Native is a JavaScript framework for writing hybrid native mobile applications for both iOS and Android platforms. React Native uses the same JSX and React development approach you would take for developing for the browser, but applications get built as native applications in Objective-C (for iOS) or Java (for Android) by the React Native tooling.

Why would you use React Native

React Native allows you to target both iOS and Android platforms with cross-platform code utilizing the technologies and patterns your web development team are likely familiar with already. Creating a screen is as simple as writing a react component that accepts props and uses react-native specific tags such as <Text> and <View>. Developers can use packages such as Redux to store application state and CSS Flexbox to layout content.

Getting started with React Native

Using expo
The quickest and easiest way to get started with React Native is via the expo cli. Expo is a toolchain built around React Native allowing you to get started quickly without needing to set up Xcode or Android studio. allows you to get up and running in minutes and provides access to a large number of device APIs and useful packages to build an application. To do so, simply run:

npm install -g expo-cli expo init my-expo-app # make project choices cd my-expo-app && npm start
npx react-native init my-cli-app Cd my-cli-app && npx react-native run-iOS

Using TypeScript with React Native

But what about TypeScript? You may have noticed during your set up with the expo cli that there’s an option provided for TypeScript in the initialization wizard. Simply select TypeScript and you get a TypeScript React Native project set up and ready to go.

npx react-native init my-ts-app --template react-native-template-typescript

Building and releasing your app

If you have used Expo to build your application, then you are able to use the expo build tool to build and package both your iOS/iPadOS and Android apps. This is pretty straightforward and uses a cloud-based build platform to create your application binaries. You can then upload these binaries to the appropriate app stores or send links to your testers for testing via TestFlight, etc.

When You Shouldn’t Use React Native

React native is a great solution if you’re looking to get into native mobile development and wish to utilize your team’s existing React and web development skills. The limits of this approach will largely depend on your needs; if you want to use advanced device hardware interaction you may find that there is not a suitable package or API available to achieve this and thus you will have to write a custom native module to use with your app. With that in mind, you may still need to write some Objective-C and Java code to achieve your goals.

Next Steps

Now that you’ve gotten started, you’ll want to continue building out your application with architectural features such as a data store, routing and a component library.

Modernizing Apps, Tools & Teams | sitepen.com | Twitter: @sitepen