I try returning class instance through getState() but it always just return just Javascript Object. Is this default behavior? How to return class instance?
Below is the example code.
import alt from '../alt';
import ScheduleActions from '../actions/ScheduleActions.js';
import ScheduleApiUtils from '../utils/ScheduleApiUtils';
class ScheduleStore {
constructor() {
this.state = {
test: new String("test")
}
console.log(this.state.test instanceof String); // return true
}
static getSchedules() {
console.log(this.getState().test instanceof String); // return false
}
}
export default alt.createStore(ScheduleStore, 'ScheduleStore');
I try returning class instance through getState() but it always just return just Javascript Object. Is this default behavior? How to return class instance? Below is the example code.