扫码关注官方订阅号
在react中利用fetch获取数据并渲染到页面该怎么做?分哪几个步骤,
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
actions:
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 }); }; }
还是不太懂,有没有详细点的答案啊
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
actions:还是不太懂,有没有详细点的答案啊