React 之中fetch 應該怎么寫
3 回答

拉風的咖菲貓
TA貢獻1995條經驗 獲得超2個贊

楊__羊羊
TA貢獻1943條經驗 獲得超7個贊
actions:
export const getMenu = () => { return async (dispatch) => { let msg = await fetch('data/nodes',{
method: 'POST', //body: JSON.stringify({"aa":"aa"}),
header: {'content-type':'application/json; charset=utf-8'}
}).then((res)=>res.json()); var state = { nodes: msg };
dispatch({ type: 'INIT',
state
});
};
}
添加回答
舉報
0/150
提交
取消