Quizzical is a React-based quiz application that fetches trivia questions from the Open Trivia Database API and presents them to users in a multiple-choice format.
This project was bootstrapped with Create React App.
- Fetches 5 random quiz questions from an external API.
- Dynamically shuffles the correct answer among the incorrect answers for each question.
- Renders each question with multiple-choice radio buttons.
- Allows users to check their answers and displays their score.
- Responsive and user-friendly interface.
quizzical_app/
├── public/
│ ├── index.html
│ └── ... (favicon, manifest, etc.)
├── src/
│ ├── App.js # Main React component with quiz logic and rendering
│ ├── App.css # Styles for the app
│ ├── index.js # Entry point for React
│ └── index.css # Global styles
├── package.json
└── README.md
- On load, the app fetches 5 quiz questions from the Open Trivia Database API.
- For each question, the correct answer is inserted at a random position among the incorrect answers.
- Each question and its possible answers are displayed as radio inputs with labels.
- Users can select answers and check their score.
In the project directory, you can run:
npm start— Runs the app in development mode at http://localhost:3000.npm run build— Builds the app for production.npm test— Runs tests (if any are added).
- You can change the number of questions by modifying the API URL in
App.js. - Styles can be updated in
App.cssandindex.css.
- React
- html-entities (for decoding HTML entities in questions/answers)
- Trivia questions provided by Open Trivia Database.