Skip to content

More concise Vue integration #109

@texastoland

Description

@texastoland

I was just reading your Vue bindings! Maybe they could be simplified by manually triggering a ref without the reactive proxy 👀

export function enableVueBindings({ shallowRef, triggerRef }) { // Vue namespace
  customCreateAtom = (name, onBecomeObserved) => {
    onBecomeObserved?.()
    const ref = shallowRef()
    return {
      reportObserved: () => ref.value // read
      reportChanged: () => triggerRef(ref) // write
    };
  };
  customReaction = undefined // automatic in Vue
}

Totally untested 😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions