import { Box } from "@mui/material"; import { useEffect, useRef, useState } from "react"; import QuizAnswerer from "./QuizAnswerer"; import { QuizIdContext } from "./contexts/QuizIdContext"; import { RootContainerWidthContext } from "./contexts/RootContainerWidthContext"; interface Props { quizId: string; } export default function WidgetApp({ quizId }: Props) { const [rootContainerSize, setRootContainerSize] = useState(Infinity); const rootContainerRef = useRef(null); useEffect(() => { const handleWindowResize = () => { if (!rootContainerRef.current) return; setRootContainerSize(rootContainerRef.current.clientWidth); }; window.addEventListener("resize", handleWindowResize); return () => { window.removeEventListener("resize", handleWindowResize); }; }, []); return ( ); }