You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there is a Date observable on a class instance then toJS turns it into some kind of Object - but not a date. JSfiddle is here: https://jsfiddle.net/af4faun5/1/
const {observable, toJS} = mobx;
class Todo {
@observable title;
@observable dueDate = new Date();
constructor(title) {
this.title = title;
}
}
var todo = new Todo("Something to do");
console.log(todo.dueDate); // original is a date...
var obj = toJS(todo)
console.log(obj.dueDate); // ..but not after toJS
The text was updated successfully, but these errors were encountered:
If there is a Date observable on a class instance then toJS turns it into some kind of Object - but not a date. JSfiddle is here: https://jsfiddle.net/af4faun5/1/
The text was updated successfully, but these errors were encountered: