I am learning Mobx. when(predicate: () => boolean, effect?: () => void, options?)
As written on mobx:
class MyResource {
constructor() {
when(
() => !this.isVisible,
() => this.dispose()
);
}
@computed get isVisible() {
......
}
dispose() {
......
}
}
My question is that if I write as follows, do these two the same?
class MyResource {
constructor() {
when(
!this.isVisible,
this.dispose
);
}
@computed get isVisible() {
......
}
dispose() {
......
}
}