This project was bootstrapped with Create React App.
In the project directory, you can run:
npm start
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
npm test
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
npm run build
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
npm run eject
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
redux没有依赖收集,mobx和vuex都需要依赖收集
封装useSelector,useDispatch
redux--数据的不可变性,JS变量可变换的
reducer作用:用于修改state,是真正做事的,可以理解是Redux工厂中的员工。
reducer是纯函数(不能修改入参,并且相同的入参永远得到唯一的输出)
装饰器:@babel/plugin-syntax-decorators
const newState=JSON.parse(JSON.) //不能复制方法
const newState={...state} //层级较浅
const newState=Object.assign({},state) 提高效率
immutable库,
immer库
flux数据流思想:一切外部数据都要从props进来
异步调接口---按照流程的话需要两次dispatch,其后一个的返回需要返回一个没有任何语意的type,如果不想要这样做,可以通过插件解决 redux-thunk ,
redux-thunk 要求异步action creator返回一个函数,redux-thunk会给函数dispatch参数 在异步的进入之前,判断是否是function,如果是function则在回调函数中加入patch 如果不是就跳过
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。