在react中利用fetch获取数据并渲染到页面该怎么做?分哪几个步骤,
                    
                    
                1 回答
 
                    
                    
                            不负相思意
                            
                                
                            
                        
                        
                                                
                    TA贡献1777条经验 获得超10个赞
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
	提交
		取消
	