23 lines
538 B
TypeScript
23 lines
538 B
TypeScript
import { AnyQuizQuestion } from "@model/questionTypes/shared";
|
|
import { create } from "zustand";
|
|
import { devtools } from "zustand/middleware";
|
|
|
|
|
|
export type QuestionsStore = {
|
|
questionsById: Record<number, AnyQuizQuestion | undefined>;
|
|
};
|
|
|
|
const initialState: QuestionsStore = {
|
|
questionsById: {},
|
|
};
|
|
|
|
export const useQuestionsStore = create<QuestionsStore>()(
|
|
devtools(
|
|
() => initialState,
|
|
{
|
|
name: "QuestionsStore",
|
|
enabled: process.env.NODE_ENV === "development",
|
|
}
|
|
)
|
|
);
|