21 Matching Annotations
  1. Aug 2022
  2. Oct 2020
  3. Oct 2019
  4. Sep 2019
    1. types.refinement might be what you're looking for, you could combine that with for example react-final-form. it is not depending on redux anymore. a form component of react-final-form wrapped by an @observer and using an action within onSubmit callback of it to actually persist the state has worked out well for me recently.
    1. Still, you have the option of moving the state that you want to read immediately into some sideways mutable object, especially if you don’t use it as a source of truth for rendering. Which is pretty much what MobX lets you do
  5. Jun 2017
    1. "Lazy", "stale", "reactive". Lots of buzzwords.

      Here's a simple explanation for the fullName/nickName magic (fullName stops being watched if nickName exists):

      On every component render, Mobx registers all the attributes they've accessed on state, so it will trigger a forceUpdate on them whenever one of these attributes change.

      If at one render (when there's a nickname) some attribute is not accessed (fullName), the MobX will not register an access on that attribute, so subseqüent changes of that attribute will not trigger forceUpdates anymore.

      If for some reason that attribute (fullName) is accessed ever again (either due to nickName ceasing to exist or due to some other internal component logic) that value is simply given to the component and it starts to be observed again and to trigger forceUpdates again on that component.