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;
}
}

相关文章:

  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
  • 2022-12-23
  • 2021-05-13
猜你喜欢
  • 2021-06-05
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
相关资源
相似解决方案