MCPcopy Create free account
hub / github.com/code100x/daily-code / handleOptionSelect

Function handleOptionSelect

apps/web/components/mcq/MCQQuestion.tsx:22–34  ·  view source on GitHub ↗
(option: string)

Source from the content-addressed store, hash-verified

20 const [isCorrect, setIsCorrect] = useState<boolean | null>(null);
21
22 const handleOptionSelect = (option: string) => {
23 if (isSubmitted) {
24 return;
25 }
26 if (selectedOption === option) {
27 setAtempted((prev) => ({ ...prev, [question.id]: false }));
28 setSelectedOption(null);
29 return;
30 }
31 setSelectedOption(option);
32 setAtempted((prev) => ({ ...prev, [question.id]: option == question.correctOption }));
33 setIsCorrect(null);
34 };
35
36 useEffect(() => {
37 if (isSubmitted) {

Callers 1

MCQQuestionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected