通过axios请求数据
相关目录
|----services
|--request.js #封装的网络请求
|--recommend.js #请求的数据接口
|--config.js #请求地址
|----store
|--index.js #引入redux-thunk中间件,导出reducer
|--reducer.js #定义数据
|--actionCreators.js #redux中生成action
|--constants.js #定义常量
流程:
网络请求封装接口------>store文件夹中存储数据------->通过redux-hooks发送网络请求
| | |
services文件夹中的 constants.js定义常量 在components中定义组件
recommend.js actionCreators.js useSelector()获取redux定义
reducer.js 的state,useEffect()请求数据