Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6214

mobx: class method call when changing data

$
0
0

Сan I use the Mobx library to call a class method when data changes?

For example MyObject writes container['item'] = 10 and as a result the myaction method is called.

class MyElement extends Component<any> {    // modifiable data    container: any = [];    // method called when data (container) is modified    myaction() {        console.log('container was modified');        console.log(this.container);    }    render() {<MyObject container = {this.container} />    }}decorate(MyElement, {    container: observable} as any)

Viewing all articles
Browse latest Browse all 6214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>