Does useLocalObservable in MobX make its getters computed values?

Viewed 9

I noticed that useLocalObservable makes functions into mobx actions automatically, the same way that makeAutoObservable does for classes.

Does it also make getters into mobx computed values?

import { useLocalObservable } from 'mobx-react-lite';

const state = useLocalObservable(() => ({
  isShowDragMeTooltip: false,

  showDragMeTooltip() {
    this.isShowDragMeTooltip = true;
  },

  hideDragMeTooltip() {
    this.isShowDragMeTooltip = false;
  },

  get dragMeTooltipStyles() {
    return {
      display: this.isShowDragMeTooltip ? 'block' : 'none',
    };
  }
}));

In the code above, is dragMeTooltipStyles a computed value with its own memoization, or will it be a normal getter that is recalculated every time it is called?

0 Answers
Related