一、安装
npx create-react-app my-app --template typescript
安装太慢,更改镜像源
1> 查看镜像源
npm config get registry
2>更改镜像源
npm config set registry https://registry.npm.taobao.org(2021年不让用了)
npm config set registry https://registry.npmmirror.com
二、TS
1、 TypeScript的有点
- 程序更加容易理解,使用ts代码本身可以提示对应的参数类型
- 效率更高,代码可以自动补全,以及丰富的接口提示
- 更少的错误,编译期间就可以发现大部分错误,杜绝一些问题的出现
2、