Skip to content

To be honest, I think it's a bit too complicated #20

Description

@hairyf

The plugin I envisioned should be simple and easy to use

import { proxy } from "valtio-plugin"
import { subscribe, ... } from "valtio/vanilla"
import { devtools } from 'valtio/utils';

function plugin(options) {
  return (state) => {
    // init
    // subscribe(change)
    // ...
    return () => {} // dispose(optional)
  }
}

proxy.use(globalPlugin({...}))

const instance = proxy.createInstance()

instance.use(plugin)

const state = instance({...})

devtools(state)

I know this will lose a lot of state handling, but the question is, do we need so many methods

I noticed that many interception operations have been implemented in the source code. Will this affect the stability of the framework?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions