1
私は読んでほしいコレクションがあります。私は何かをしたいと思っていますが、Mobxがリアクティブ関数を作成する方法を提供しているかどうかはわかりません。Mobxで観測可能な関数を実行するには?
class Store{
private _col:Mobx.Map;
...
@observable public has(id){
return _col.has(id);
}
}
私は、信頼関係のないクライアントを念頭に置いてゲームアーキテクチャを採用しています。だから私は自分の意見が_col
に直接アクセスするのを望んでいません。
@observe
class MyView extends Component {
...
componentWillMount(){
this.id = this.props.params.id;
autorun(()=>{
this.props.store.has(this.id)
//do something smart
}
}
...
}
代替手段は何ですか?