What should I use to declare state globally? for example, I have a variable isActive as admin, I want to change the value to true then, all users who access my website will automatically get the isActive value as true what should I use? I don't want the user to continuously query the database just to retrieve that value. The solution I thought of was using static in the class or creating static variables. But is there another solution from Qwik?
#global variable in qwik
4 messages · Page 1 of 1 (latest)
Would something like this help? https://discord.com/channels/842438759945601056/1214498085028495390
do you have example how to use it ?
currently, I create something like this
export class Announce {
private static isActive: boolean = false;
static setActiveStatus(status: boolean): void {
Announce.isActive = status;
}
static getActiveStatus(): boolean {
return Announce.isActive;
}
}
It doesn't exist yet, we're discussing what it would look like.
I'm thinking something like an async function clientData() in the root layout that gets the request and returns the data