computed mobx
Estimated reading time: 1 minutewhat is computed
computed is a calculation method but return result instance.
// store/Index.js
import {observable, computed} from "mobx";
class OrderLine {
    @observable price = 20;
    @observable vat = 1;
    constructor(price) {
        this.price = price;
    }
    @computed get total() {
        return this.price + this.vat;
    }
}
Access computed
{this.props.store.total}