How to use the runInAction function from mobx

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

53
54
55
56
57
58
59
60
61
62
  .then(action(() => {
    state.successCount += 1
  }))
}
else {
  runInAction(() => {
    state.successCount += 1

    //enqueueEvents([{ section: 'test', type: 'test.blah' }])
  })
fork icon0
star icon2
watch icon2

+ 13 other calls in file

281
282
283
284
285
286
287
288
289
290
function useAsObservableSourceInternal(current, usedByLocalStore) {
    if (usedByLocalStore && current === undefined) {
        return undefined;
    }
    var _a = __read(React__default.useState(function () { return mobx.observable(current, {}, { deep: false }); }), 1), res = _a[0];
    mobx.runInAction(function () {
        Object.assign(res, current);
    });
    return res;
}
fork icon0
star icon0
watch icon0

+ 9 other calls in file