this.setstate不是本机反应中的函数

时间:2017-06-22 23:03:31

标签: react-native

我在反应原生中遇到箭头功能问题。当我写一个箭头函数时,我收到错误说

  

this.setstate不是函数

但是当我写一个常规函数时,我没有得到任何错误。有人能告诉我问题出在哪里。我的代码在

之下
var Register = React.createClass({

getInitialState : function(){

return {
ad:'',
soyad:'',
mail: '',
gcm_id:'',

},
componentWillMount: function() {
this.get_db();
},
get_db: async ()=> {     
this.setState({ mail: 'adadsasd' });    

},

})

0 个答案:

没有答案
相关问题