【发布时间】:2019-04-27 16:08:55
【问题描述】:
我想将用户名保存在username 状态。现在在控制台中我在运行componentDidMount 时看不到用户名。
但如果我按下按钮并按下它,我可以看到用户名。
componentDidMount(){
this._get_loggin_data();
console.log(this.state.username);
}
_get_loggin_data = async () => {
let result = await SecureStore.getItemAsync('username');
this.setState({username:result})
}
【问题讨论】:
标签: react-native expo