Skip to content
Discussion options

You must be logged in to vote

Stores can be classes, they just won't wrap child classes. But once they are marked as proxy they will work as a child of other stores and will wrap. Solid exports a symbol that when present on an object(or class instance) will pre-empt the stores not wrapping behavior.

What I'm saying is you can always:

const [store, setStore] = createStore(new MyClass());

Now that isn't too ergonomic but you could wrap that in a function:

function storify(someClassInstance) {
  const [store] = createStore(someClassInstance);
  return store;
}

And then:

setItems(i => [...i, storify(new MyClass())])

Now in the case of certain types of objects I wouldn't expect much. Just because something is a store doesn…

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
7 replies
@SoTosorrow
Comment options

@atk
Comment options

@SoTosorrow
Comment options

@atk
Comment options

@SoTosorrow
Comment options

Comment options

You must be logged in to vote
4 replies
@SoTosorrow
Comment options

@ryansolid
Comment options

@SoTosorrow
Comment options

@khokm
Comment options

Answer selected by SoTosorrow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants