how to put the types to the context

this is the erros i get when trying to use the context, i have the type of the array is this
type ServerModel =
{
id: string;
pwd: string;
name: string;
host: string;
port: string;
user: string;
licenses: LicenseModel[];
databases: DatabaseModel[];
};
type ServerModel =
{
id: string;
pwd: string;
name: string;
host: string;
port: string;
user: string;
licenses: LicenseModel[];
databases: DatabaseModel[];
};
No description
No description
1 Reply
Martnart
Martnart13mo ago
createContext accepts a generic type. You should pass the type of your context.
type ServerContext = {
serverContent: Store<ServerModel[]>
setServerContent: SetStoreFunction<ServerModel[]>
}
type ServerContext = {
serverContent: Store<ServerModel[]>
setServerContent: SetStoreFunction<ServerModel[]>
}
Want results from more Discord servers?
Add your server