Как я могу установить значение хранилища mobx со стороны сервера в качестве начального значения (из fetch / http)?
import { computed, observable } from 'mobx';
import { Instrument } from '../models/core/instrument';
class ObservableInstrumentStore {
//should set init value from server instead of setting to empty array
@observable instruments: Instrument[] = [];
@computed get getInstruments(): Instrument[] {
return this.instruments;
}
addInstruments(instruments: Instrument[]): void {
this.instruments = instruments;
}
}
export const observableInstrumentStore = new ObservableInstrumentStore();