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

DIEA
TA貢獻1820條經驗 獲得超2個贊

滄海一幻覺
TA貢獻1824條經驗 獲得超5個贊
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
});
};
}
- 3 回答
- 0 關注
- 744 瀏覽
添加回答
舉報
0/150
提交
取消