There are some miscellaneous APIs that are provided by MobX that are not that frequently used. It is still worth mentioning them here for the sake of completeness.
When dealing with the various abstractions in MobX (observables, actions, reactions), it is sometimes useful to know if a certain object, function, or value is of a certain kind. MobX has a set of isXXX APIs that help you to determine the type of the value:
isObservableObject(thing)
,isObservableArray(thing)
,isObservableMap(thing)
: Tells you whether the passed in value is an observable object, array, or mapisObservable(thing)
andisObservableProp(thing, property?)
: Similar to the preceding point but more generalized check for an observable valueisBoxedObservable(thing)
: Whether the value is a boxed observableisAction(func)
: Returnstrue
if the function is wrapped by an actionisComputed(thing)
andisComputedProp(thing, property?)
: Checks whether the value is a computed property