Click to expand
- 📜 Project Description- ⚙️ Technologies Used
- 🔗 Demo
- 🔨 Installation
- 🚀 Usage
- 🧰 Components Overview
- 🎵 Sound Integration
- 🎨 Animations
- 🔄 Routing & Dynamic Quizzes
- 📝 Notes
- 📝 Credits
- 📞 Contact
This Quiz App is a React single-page application built with TypeScript that lets users take multiple quizzes on topics like Movies, TV, Books, Computer Science, Celebrities, and History.
The app dynamically loads quiz data based on user selection, supports answer validation, plays sounds, and shows results with engaging Lottie animations.
- Dynamic quizzes based on selected topic
- Multiple-choice questions with answer shuffle
- Sounds for correct/wrong answers using Howler.js
- Final results with animated feedback
- React Router for navigation
- Strong TypeScript support across the app
Check out the live demo of the Quiz:
To run this project locally, follow the steps below:
- Clone the repository:
git clone https://github.com/makedonkatochevska/react_quiz.git .- Install dependencies:
npm install- Start the development server:
npm run dev- The CardContainer displays all quiz category cards using
BANNER_IMAGESas background. - Clicking a card navigates to
/quiz/:quizType(e.g.,/quiz/movieQuiz) using React Router. - QuizPage loads the appropriate quiz by reading the
quizTypeparam. - QuestionsContainer fetches data from
DATA_URL[quizType]and displays questions. - Each question is rendered via MultipleAnswerQuestion, with randomized answers.
- ResultsContainer updates live to reflect:
- Correct answers
- Incorrect answers
- Remaining questions
- Once all questions are answered:
- A final loading animation plays
- Then, FinalResult is shown with a Lottie animation (success or failure)
- Quiz can be restarted using the Restart button, which scrolls to top and reloads questions.
- Displays the quiz topic cards.
- On click, routes to
/quiz/:quizType.
- Dynamically loads quiz content based on route param.
- Fetches questions using the
quizTypekey. - Tracks user answers, correctness, and resets.
- Triggers scroll to top on quiz start/reset.
- Displays results after all questions are answered.
- Renders each question with shuffled answer options.
- Handles answer selection and validation.
- Shows current quiz stats: total, correct, incorrect, remaining.
- Summary with a Lottie animation depending on quiz performance.
- Includes a reset button to restart the quiz.
Loadingshows an animation while fetching.ErrorComponent(used for fallback UI on fetch error).
- Sound effects added using Howler.js.
- A custom
useSoundhook handles audio playback. - On correct or incorrect answer selection, a sound plays immediately.
- Sounds are currently stored locally in
/public/Sounds.
- Final result screen includes animations using Lottie via
@lottiefiles/dotlottie-react. - Two animations are used:
- ✅ Smile (when more than 50% correct).
- ❌ Sad Emoji (if under 50%).
- Built with React Router.
- Routes:
/– Home page with quiz category cards./quiz/:quizType– Loads questions dynamically based on selected topic.
- Quiz data and banners are pulled based on
quizTypeparam from:DATA_URL[quizType]– for questionsBANNER_IMAGES[quizType]– for visual banners
- The app supports smooth scroll to top on quiz reset.
- FontAwesome icons are used for navigational elements.
- Fully responsive UI.
- Developed with React + TypeScript using
.tsxcomponents. - All props and components are strictly typed.
- Quizzes are rendered dynamically, allowing easy expansion with more topics.
This app was developed as a personal learning project to practice:
- Dynamic routing
- State and props management
- Component reusability
- Type-safe development with TypeScript
- Animations and sound UX integration
📫 You can reach me at makedonkatochevska@gmail.com or connect with me on: