-
I am trying to sort out how annotations work in For example we have the next: import { makeObservable, observable, action } from '/mobx.js';
makeObservable({
counter: 0,
inc() {
this.counter++;
}
}, {
counter: observable,
inc: action
})
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
When you use these functions as annotations, you should think of them as symbols, like so: if (annotation === observable) {
// some logic that defines observable prop
} In the actual implementation, there are extra props defined on these functions that are being used by |
Beta Was this translation helpful? Give feedback.
When you use these functions as annotations, you should think of them as symbols, like so:
In the actual implementation, there are extra props defined on these functions that are being used by
makeObservable
, but that's an implementation detail. You can't implement your own annotation, there is no publicAnnotation
interface.