Redux中发送异步请求获取数据
1. charles模拟数据
先在桌面创建一个list.json的文件:
["hello","scott","xiong"]
然后用charles做接口转发
打开charles,选择 Tools/Map Local/Add, 然后配置如下:

2. 安装axios
yarn add axios
http请求放在componentDidMount()中:
先在桌面创建一个list.json的文件:
["hello","scott","xiong"]
然后用charles做接口转发
打开charles,选择 Tools/Map Local/Add, 然后配置如下:

yarn add axios
http请求放在componentDidMount()中: