VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
React / Typescript Tutorial - Build a Quiz App

React / Typescript Tutorial - Build a Quiz App

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Learn how to use React and TypeScript to create a quiz app project. You will also learn how to use Styled-Components with React. - What you will make: https://tender-mcnulty-a4a646.netlify.app/ - Code: https://github.com/weibenfalk/react-quiz - Course from Thomas Weibenfalk. https://github.com/weibenfalk/react-quiz - Course from Thomas Weibenfalk. Check out his YouTube channel: https://www.youtube.com/user/Weibenfalk - Thomas's website: https://www.weibenfalk.com/
Date: 2022-03-14

Comments and reviews: 10


TypeError: cannot read property 'map' of undefined. what should i do?
import React from -react-;-
type Props = --
question: string;-
answers: string[];-
callback: any;-
userAnswer: any;-
questionNr: number;-
totalQuestions: number;-
--
const QuestionCard: React.FC = ( --
question, -
answers,-
callback,-
userAnswer,-
questionNr,-
totalQuestions-
-) => (-
Question: -questionNr- / -totalQuestions--
-answers.map(answer => (-
))--
);-
export default QuestionCard;

reply

Informative and easy to follow. BUT, NOT SMART teaching beginners to use -Dangerously Set innerHTML-. Even if you say it's -ok- to use. What benefit is a beginner getting out of this? You're teaching beginners dangerous and bad habits that you have. No one mentions in the comments because they don't even realize. It'd be best to teach how to make a quiz app without putting high risk, and obscure things into an easy friendly teaching app. Cheapens the whole project and makes it useless. What's worst is you use it multiple times...
reply

Bonjour,
Hello,-
Thank you again for this tutorial which is very well explaining just a small problem at the -answers.map- level-
-which returns an undefined value I check on the git restart the project after having downloaded it is the error is the same the map in itself is good but the value which is returned is undefined which makes the program crash an idea ?

reply

dangerouslysetinnerhtml - why it is necessary - Why not just pass: -question- or answer -answer- -
it was my understanding that babel in react would convert JSX into JS as well as HTML but maybe I am wrong. So the question is why using dangerouslysetinnerhtml to put directly HTML instead of JSX when we can do that normally? what is the point of or the differences?

reply

I have a question at 35:59 Here you used an arrow function WITHOUT curly parenthesis - -, if I use them, I get 'undefined' for my answers-array at 38:32. Why does removing curly parenthesis shows the correct output?
reply

For those stuck as I was for a while with a TS error:
When he applies an OR to the Props using a 'Pipe', it looks like a slash. That's due to the confusing font.
Use a Single Pipe - to declare 'OR' in Typescript

reply

after using -.json()- when fetching the endpoint, the data is displayed in literal unicode. Like the symbol ' is being displayed as '. It happened with several other symbols. Does anyone know how to fix it?
reply

If anyone has any issues with dependencies after running the first -npm start- remove the -node_modules- folder from your desktop or home directory(if you're on Linux)
reply

Ok tutorial. Very little to no explanation of how everything works. Another one of these tutorials that you just copy along but unfortunately not really learn much.
reply

Great tut Thank you, Apr/2021 note if you are using react-17 make it won't work, downgraded goes fine. Thank you again, hope to see more good code from you.
reply
Add a review, comment






Other channel videos