Getting Started with React Native
At my job I do some work in React Native, and since I've learned React, React Native has made way more sense. React Hooks and components are still here, while is awesome. Along with that comes a bunch of weird unique tags like TouchableOpacity, View or Text. It's not so bad, because ultimately it seems like you are working with less tags than are available in HTML. Anyway, I like React Native for the same reasons I like React. I still think I prefer to work on apps using Xamarin.Forms, but I'm only just getting started in React Native so that could always change.
At work I typically use Android Studio, which is a great tool (if you have a decent amount of RAM), but for now I'm going to be using the Expo CLI to develop, which is a great way to quickly start writing code with minimal setup. The steps I used are listed here, but they are brief so I'll cover them as well.
- Navigate to wherever you plan on creating this app, and run npm install -g expo-cli
- Once that finishes, run expo init ProjectName to create a new project. You can select the default blank project.
- cd ProjectName to get into its directory, and run npm start to run the development server.
- Okay now pull out your phone and install the Expo app (the logo is shown below). Your phone and computer will need to be on the same network.
- The app should have you scan the QR code that comes up when running the development server, and then you'll be able to check out the app from your own phone, without running an emulator or Android Studio!
Expo is somewhat limited, you can't use custom native modules, only the ones available from the Expo app. It's still a nice way to get started, or just play around with React Native. I made a simple tip calculator, you can see the full code here, but the App.js file is included below.
Comments
Post a Comment