@@ -60,8 +60,8 @@ import questionBank from "../../data/quizzes/questionBank"
6060
6161interface IProps {
6262 quizKey ?: string
63- currentHandler : ( next ?: string ) => void
64- statusHandler : ( status : QuizStatus ) => void
63+ currentHandler ? : ( next ?: string ) => void
64+ statusHandler ? : ( status : QuizStatus ) => void
6565 maxQuestions ?: number
6666 isStandaloneQuiz ?: boolean
6767}
@@ -112,7 +112,7 @@ const QuizWidget: React.FC<IProps> = ({
112112 setSelectedAnswer ( null )
113113
114114 if ( ! isStandaloneQuiz ) {
115- statusHandler ( "neutral" )
115+ statusHandler ?. ( "neutral" )
116116 }
117117
118118 const currentQuizKey =
@@ -220,11 +220,11 @@ const QuizWidget: React.FC<IProps> = ({
220220
221221 if ( ! isStandaloneQuiz ) {
222222 if ( currentQuestionAnswerChoice ?. isCorrect ) {
223- statusHandler ( "success" )
223+ statusHandler ?. ( "success" )
224224 }
225225
226226 if ( ! currentQuestionAnswerChoice ?. isCorrect ) {
227- statusHandler ( "error" )
227+ statusHandler ?. ( "error" )
228228 }
229229 }
230230 }
@@ -241,7 +241,7 @@ const QuizWidget: React.FC<IProps> = ({
241241 setShowAnswer ( false )
242242
243243 if ( ! isStandaloneQuiz ) {
244- statusHandler ( "neutral" )
244+ statusHandler ?. ( "neutral" )
245245 }
246246 }
247247
@@ -274,7 +274,7 @@ const QuizWidget: React.FC<IProps> = ({
274274
275275 // Reset quiz status (modifies bg color for mobile)
276276 if ( ! isStandaloneQuiz ) {
277- statusHandler ( "neutral" )
277+ statusHandler ?. ( "neutral" )
278278 }
279279
280280 if ( finishedQuiz ) {
@@ -288,7 +288,7 @@ const QuizWidget: React.FC<IProps> = ({
288288 }
289289
290290 const handleNextQuiz = ( ) => {
291- currentHandler ( nextQuiz )
291+ currentHandler ?. ( nextQuiz )
292292 }
293293
294294 const AnswerIcon = ( ) => {
0 commit comments