学习React Native(1)
打开官网React Native
目标:通读一遍Getting Started
npm install -g create-react-native-app
create-react-native-app AwesomeProject
#这里发生错误 npm@5不支持,要求使用npm 4
npm i npm@4 -g
#删掉重新生成项目
rm -r AwesomeProject
create-react-native-app AwesomeProject
cd AwesomeProject
npm start
手机端安装Expo client
为项目目录初始化了git仓库
git init
git add *
git commit -m "初始化项目"
import React,{ Component } from 'react';
import { AppRegistry,Text } from 'react-native';
export default class HelloWorldApp extends Component {
render() {
return (
<Text>Hello world!</Text>
);
}
}
// skip this line if using Create React Native App
AppRegistry.registerComponent('AwesomeProject',() => HelloWorldApp);
原文链接:https://www.f2er.com/react/302881.html