React 学习记录

使用 axios:
Redux – action:
const res = await axios.post(API_URL + ‘candidate/’, candidate);
dispatch(setAlert(‘Candidat créé’, ‘success’));
dispatch({
type: ADD_CANDIDATE,
payload: res.data
});
history.push(‘/candidate’);

Redux – reducer:
case GET_CANDIDATES:
return {
…state,
candidates: payload
};

 


欢迎大家关顾我的Facebook主页「Y Life Book」以及我的公众微信号「不点语书」,我们下期见。

Leave a Comment

Your email address will not be published. Required fields are marked *