EzekelRAGE
Superstar
Past 3ish days I been watching/coding along to this in their scrimba thing. This course is free on scrimba too btw.
First off, that scrimba stuff is some nice ass tech. The interactiveness of it is crazy. Lessons are like Screensharing but you can jump in anytime
and mess with stuff. When you get done messing with stuff, just hit play again and vid picks up like nothing happened.
Second, React is fukking amazing, especially compared to something like EJS. Granted, this is just the introductory course but still I'm really liking it. Only went over SPA stuff. No routing. Also useEffect and useStates are the only hooks the course goes over. Even then those hooks seem like gamechangers to me.
Currently working on the solo assignment given at the end of the course. Basically a quiz app. User gets five questions fetched from an online trivia db. Clicks what they think are the right answers, then can check the answers.
Had to code it from scratch with only these images to go by:
Started on the questioning part and this is what I have so far:
Questions and answers are in a useState. That allowed me to pass props to the answer component that let users click their choice. Formatting for the fetched data was kinda trash, so had to customize it a bit to my liking(adding ids for stuff, giving each answer an "isClicked" property that is defaulted to false.)
Logic for Clicking Answer: Used nanoid to give each question and answer their own id. When an answer is clicked a function runs that takes the qid and the aid. It finds the question and looks at all the answers it holds. Filters thru each answer and if it doesnt match the answerId that was clicked, sets it "isClicked" property to false. When it finds the one that was clicked, it changes it's "isClicked" value to true. I have conditional styling setup, so when that click happens, the bg changes to that clicked answer.
Now I just need to put the logic in for checking answers and playing again. Both those should be simple compared to what I already did.
Used the Fisher Yates shuffle thing to shuffle the answers before sending it to questions State. Otherwise all the answers wouldve been in the same spot.
First off, that scrimba stuff is some nice ass tech. The interactiveness of it is crazy. Lessons are like Screensharing but you can jump in anytime
and mess with stuff. When you get done messing with stuff, just hit play again and vid picks up like nothing happened.
Second, React is fukking amazing, especially compared to something like EJS. Granted, this is just the introductory course but still I'm really liking it. Only went over SPA stuff. No routing. Also useEffect and useStates are the only hooks the course goes over. Even then those hooks seem like gamechangers to me.
Currently working on the solo assignment given at the end of the course. Basically a quiz app. User gets five questions fetched from an online trivia db. Clicks what they think are the right answers, then can check the answers.
Had to code it from scratch with only these images to go by:
Started on the questioning part and this is what I have so far:
Logic for Clicking Answer: Used nanoid to give each question and answer their own id. When an answer is clicked a function runs that takes the qid and the aid. It finds the question and looks at all the answers it holds. Filters thru each answer and if it doesnt match the answerId that was clicked, sets it "isClicked" property to false. When it finds the one that was clicked, it changes it's "isClicked" value to true. I have conditional styling setup, so when that click happens, the bg changes to that clicked answer.
Now I just need to put the logic in for checking answers and playing again. Both those should be simple compared to what I already did.
Used the Fisher Yates shuffle thing to shuffle the answers before sending it to questions State. Otherwise all the answers wouldve been in the same spot.
Last edited: