This project is a solo final React project from Scrimba. It does not have solution provided. The complexity of this project includes several things such as
-
Data format from the API isn't ideal, so we need to manipulate the format (put answers together, decodeURI, random order)
-
Each question can have only 1 selected answer, while having 4 options. Therefore, we need to create a relationship between the question and 4 answers, kinda like radio button. We do this by
- Adding extra property in state(card), 'selected'
- Sending question id to update state, so we know which question does the option belongs to.
- After user selected an option, the selected value will be updated -> update class to render selected button color
-
Different visual with different conditions
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.