React初体验

118 阅读1分钟

 首先是安装:yarn global add create-react-app

create-react-app是类似vue-cli一样的脚手架,新手推荐

安装完之后开始创建第一个app吧!

采用方方的指令create-react-app react-demo-1会报错,如下:

A template was not provided. This is likely because you're using an outdated version of create-react-app. Please note that global installs of create-react-app are no longer supported.

原因尚未可知。

于是跑去create-react-app的github瞅了一下(github.com/facebook/cr…),如下:


于是使用yarn create react-app react-demo3创建成功:


根据提示运行:

cd react-demo-3
yarn start

得:


完。