Skip to content

Instantly share code, notes, and snippets.

@eiriklv
Last active January 31, 2025 06:58
Show Gist options
  • Save eiriklv/8fc310413ceb26e3f1aaacf777416ae6 to your computer and use it in GitHub Desktop.
Save eiriklv/8fc310413ceb26e3f1aaacf777416ae6 to your computer and use it in GitHub Desktop.

Concepts

  • Base primitives:

    • state
    • computed
    • effect
  • Higher level primitives:

    • async / resource (non-cached)
    • query / mutation (cached)

NOTE:

  • the async and query primitives can be built from the base primitives (but only if the equivalent of state, computed and effect exists!)

Signals

  • signal
  • computed
  • effect
  • async / resource (can be made from the base primitives)
  • query / mutation (can be made from the base primitives)

React

  • useState
  • useMemo
  • useEffect
  • useAsync / useResource (can be made from the base primitives)
  • useQuery / useMutation (can be made from the base primitives)

Jotai

  • atom
  • atom
  • atomEffect (library add-on)
  • atom / loadable (supports async atoms)
  • atomWithQuery (library add-on)

Mobx

  • observable
  • computed
  • autorun / reaction (does not have inner disposal)
  • X (can probably be made from the base primitives?)
  • X (can probably be made from the base primitives?)

Easy-peasy

  • state
  • computed
  • effectOn
  • X (can probably be made from the base primitives?)
  • X (can probably be made from the base primitives?)

Redux Toolkit

  • state
  • selector
  • listener
  • rtk-query (library add-on)
  • rtk-query (library add-on)

Zustand

  • state
  • selector
  • X (has to be implemented via subscribe and middleware)
  • X (?)
  • X (?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment