-
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.
Answered by
urugator
Aug 4, 2023
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.
0 replies
Answer selected by
dSalieri
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.