DEV Community

andrewwachira
andrewwachira

Posted on

quiz clone react

Guys, I am pretty new to react; am trying to practice react by remaking the google word coach, or just a simple quiz. In terms of the UI, not much has been done, but I have focused to see whether I can do the functionality bit. I don't know the actual problem, I would really like some assistance as to knowing how to validate the answer when the button is clicked, because right now, The code I have written on the validateAnswer() seems to freeze my computer or sth. Please help.

You can find the link to my code on StackBlitz: https://stackblitz.com/edit/react-o4hlnd

Top comments (5)

Collapse
 
andrewwachira profile image
andrewwachira

Hello Erick, I cannot thank you enough for guiding me through. It took me some time to decode or understand every line of code you changed, and I must say, you sure are a genius. The logic you put was next level. If that is "the React way", then I want to know all of it. Thank you and God bless.

Collapse
 
urmajesty516 profile image
Janice

Can you share your code?

Collapse
 
andrewwachira profile image
andrewwachira • Edited

check the two components from my github link below, or the stackBlitz link
github.com/andrewwachira/quiz-word...
stackblitz.com/edit/react-o4hlnd

the file in question is Question.js

Collapse
 
urmajesty516 profile image
Janice

Check my edited version: codesandbox.io/s/quiz-word-coach-e.... I did a rough one, but hope it helps you :)

Thread Thread
 
andrewwachira profile image
andrewwachira

thanks @Janice , for getting me unstuck from the path of logic I was on. I will improve on the code following the same logic and hopefully get good results. God bless.