SolidJSS
SolidJSโ€ข3y agoโ€ข
10 replies
hotshoe

Can a Solid store contain class objects?

Can a Solid store contain class objects?

When I implement a simple type like below as a class, reactivity breaks for me when surfacing in a Solid store via a context provider.

// Works 
export type ArtistProps = {
  id: number;
  name: string;
  genre: string;
};
... setter({ id: 1, "Kiss", "Rock "})

// Doesn't work
export type ArtistProps = {
  constructor (readonly id: number, name: string, genre: string) {}
};
... setter(new {1, "Kiss", "Rock"})


Do Solid store objects need to be pojos?
Was this page helpful?