I am learning MobX and cannot understand why autorun
is only firing once...
const {observable, autorun} = mobx;
class FilterStore {
@observable filters = {};
@observable items = [1,2,3];
}
const store = window.store = new FilterStore;
setInterval(() => {
store.items[0] = +new Date
}, 1000)
autorun(() => {
console.log(store.filters);
console.log(store.items);
console.log('----------------');
});
jsFiddle: https://jsfiddle.net/1vmtzn27/
This is a very simple setup, and the setInterval
is changing the value of my observable array every second but autorun
is not fired... any idea why?