frontAnswerer/lib/contexts/QuizIdContext.ts
nflnkr 87897a9d47 move common files to lib folder
remove kitui dependency
fix readme
2024-02-12 13:58:51 +03:00

12 lines
289 B
TypeScript

import { createContext, useContext } from "react";
export const QuizIdContext = createContext<string | null>(null);
export const useQuizId = () => {
const quizId = useContext(QuizIdContext);
if (quizId === null) throw new Error("quizId context is null");
return quizId;
};