在react native中使用mobx时初始化页面数据

1.说明:在react native中使用mobx时退出当前页面后,重新进入该页面时,初始化页面数据(多用于当前页面有筛选条件时,退出页面后mobx中数据保留筛选后的状态)

2直接上代码:

class xxxxx extends PureComponent {
constructor(props) {
super(props);
store.xxxxxx();
this.state = {
};
}
componentWillMount() {
store.yyyyy= xxxxx; //yyyyy代表你mobx中观测的变量, xxxxx代表你想初始化的值
store.yyyyy= xxxxx;
}
}
posted @ 2017-09-29 16:23  风的味道真好闻  阅读(1363)  评论(0编辑  收藏  举报