How to use the action function from mobx

Find comprehensive JavaScript mobx.action code examples handpicked from public code repositorys.

61
62
63
64
65
66
67
68
69
      //enqueueEvents([{ section: 'test', type: 'test.blah' }])
    })
  }
}

const processReceivedError = action(error => {
  console.error('processReceivedError', error)
  state.errorCount += 1
})
fork icon0
star icon2
watch icon2

+ 13 other calls in file

219
220
221
222
223
224
225
226
227
228
], Router.prototype, "matched", null);
tslib.__decorate([
    mobx.computed
], Router.prototype, "matchReg", null);
tslib.__decorate([
    mobx.action
], Router.prototype, "onShow", null);
tslib.__decorate([
    mobx.action
], Router.prototype, "onShown", null);
fork icon0
star icon2
watch icon1

+ 39 other calls in file

16
17
18
19
20
21
22
23
24
25
26
}, () => {
    console.log('react', state.compB);
});


// 함수로 만들어서 나중에 실행
const change = action(() => {
    state.compA = 'c';
    state.compB = 25;
    state.compC = 'c';
});
fork icon0
star icon1
watch icon0

932
933
934
935
936
937
938
939
940
941
], Model.prototype, "__fileDeletions", void 0);
__decorate([
    mobx_1.observable
], Model.prototype, "__fileExists", void 0);
__decorate([
    mobx_1.action
], Model.prototype, "parse", null);
__decorate([
    mobx_1.computed
], Model.prototype, "backendValidationErrors", null);
fork icon0
star icon0
watch icon0

+ 21 other calls in file