请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

this is a reserved word

fetch('http://www.baidu.com?r_userName='+forData.r_userName+'&r_password='+forData.r_password+'&r_confirm='+forData.r_confirm,myFetchOptions).

     then(response=>response.json()).then(json={

       this.setState({userNickName:json.NickUserName,userid:json.UserId});

   });

调用fetch方法,里面写入 this.setState这个方法的时候,程序报错。错误信息是如下:

https://img1.sycdn.imooc.com/szimg//594a2f3a00018a7306420276.jpg

正在回答

1回答

then(response=>response.json()).then(json=>{

       this.setState({userNickName:json.NickUserName,userid:json.UserId})


第二个没有写成箭头函数,看错误信息第44行。

1 回复 有任何疑惑可以回复我~
  • 提问者 墨水012 #1
    非常感谢!
    回复 有任何疑惑可以回复我~ 2017-06-21 22:48:13
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号