S
SolidJS10mo ago
gsoutz

If I am using a singleton class why would I use a context

class ProfileStore {

active_user: Signal<string> = makePersistent(createSignal('hello'))

}


export default new ProfileStore()
class ProfileStore {

active_user: Signal<string> = makePersistent(createSignal('hello'))

}


export default new ProfileStore()
For example what is wrong with the above method.
2 Replies
Raqueebuddin Aziz
in this case you don't need to unless you are using ssr if you are using ssr and you don't want all users to have the same singleton you need to use context
ReaperSenpaix99
ReaperSenpaix9910mo ago
Stack Overflow
Why to use Context and Provider given SolidJS reactivity?
I have this SPA project which authenticates and authorizes its users via access tokens (JWT). These short-lived access tokens has their refresh tokens as well, so when they expire the app should re...
Want results from more Discord servers?
Add your server