Let’s start by looking at what we need to implement a “Hello World” for RN.
Xiaoming: “We need a computer.” “Well… Xiao Ming please help me out of the door and close the door.
All right, without further ado, let’s make a list.
1. The homebrew installation
2. Nodejs installation
3. Rn scaffolding installation
4. Initialize the project
5. Run the project
So let’s look at the first step, Homebrew installation:
Open a terminal window, type: / usr/bin/ruby – e “$(curl – fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
“Use Homebrew to install things you need that Apple doesn’t have pre-installed,” the website explains. Brew Install is a command line tool that I can use to install any third party programs we need.
However, it is not immediately available after the installation is complete. After the installation is successful, a brew Update is required for a version update.
/usr/local/sudo chown -r whoami /usr/local/sudo chown -r whoami However, this Command cannot be executed in OS X11. Restart the MAC, press Command+R to enter the recovery mode, enable Terminal, and run csrutil disable.
After a long process of installing Homebrew, we need to build the NodeJS development environment. You can download a NodeJS installation package from the official website, and then proceed to the next step. You will feel very relaxed after you have installed Homebrew.
And then we have a scaffolding of RN, and the scaffolding basically helps us initialize the project, saves us mkdir Rn-demo, and then a dependency library, a dependency library installation. Scaffolding helps to complete this process.
Run NPM install -g react-native-cli
Then we can create our own project
// Initializes the project. Demo is the project name and can be changed at will
react-native init demo && cd demo
The scaffolding will help us configure all the dependencies in package.json, but we will install them manually
npm install
// React-native-h commands can be used to see all functions. Here are some of my own common commands
React-native run-ios// Ios startup requires Xcode update (version 8.0 or higher)
React-native run-Android // Android startup requires USB connection to the phone, and then the phone is in developer mode to allow USB debugging
Here are the moments of wonder