这个是actionCreators.js
const addHomeList = (data) => ({
type: constant.add_artice_list,
data: fromJS(data),
articetotal: Math.ceil(data.length/5),
})
export const getMoreList = () =>{
return (dispatch) =>{
axios.get('api/homeList.json').then((res) =>{
const data = res.data.data;
dispatch(addHomeList(data))
})
}
}
我在组件使用:
componentDidMount(){
this.props.changeHomeData();
}
const mapDispatchToProps = (dispatch) =>({
changeHomeData(){
dispatch(services.getMoreList());
},
})
我在请求是请求但是 老师出现闪屏现象 然后数据就没了