react + TScript + 移动端
- 安装脚手架,文件名为 xm_csdn ,配合使用 TS
npx create-react-app xm_csdn --template typescript
- 安装 sass
yarn add sass
- 安装路由及路由类型声明文件
// 路由
yarn add react-router-dom@5.3.0
// 声明文件
yarn add @types/react-router-dom -D
- antd 蚂蚁组件库(移动端)
yarn add antd-mobile
- 安装修改 CRA 配置的包,用来修改路径别名为@
yarn add -D @craco/craco
- 移动端适配,将 px 转化为 vw,所以有了该工具,只需要在代码中写 px 即可(1vw = 屏幕宽度的%1 )
yarn add -D postcss-px-to-viewport
- 安装 axios
yarn add axios
- 安装 redux 公共状态管理仓库
- redux : Redux 是一个状态管理库,它可以帮助你在 React 应用程序中管理状态。
- react-redux : React-Redux 是一个库,它可以让你在 React 应用程序中使用 Redux。
- redux-thunk : Redux-Thunk 是一个库,它可以让你在 Redux 中使用异步操作。
- redux-devtools-extension : Redux DevTools Extension 是一个 Chrome 扩展程序,它可以帮助你调试 Redux 应用程序。
yarn add redux react-redux redux-thunk redux-devtools-extension