imhardikdesai / Quiz-App

This quiz web app is built using React JS. It can allow the user to select the criteria for their quiz from a list of options. The user can then proceed to answer the questions in the quiz and their performance will be tracked and shown in the scoreboard
https://ask-quiz.netlify.app/
21 stars 18 forks source link

Update QuizArea.jsx #6

Open rishi457 opened 12 months ago

rishi457 commented 12 months ago

Here's a description of the changes made to the provided code:

  1. Timer Feature:

    • We added a timer feature to each question in the quiz.
    • useState and useEffect hooks are used to manage the timer.
    • timer state variable keeps track of the remaining time in seconds, initially set to 30 seconds.
    • timerInterval state variable is used to store the interval ID for the timer.
    • startTimer function initializes the timer and starts counting down from 30 seconds.
    • stopTimer function clears the timer interval when the question changes or when the quiz finishes.
    • In the useEffect, we start the timer when a new question is displayed and stop it when the quiz is finished.
    • The remaining time is displayed in the UI using <p>Time Left: {timer} seconds</p>.
  2. Progress Bar Feature:

    • We added a progress bar to indicate the progress of the quiz visually.
    • CSS classes progress-bar and progress are used to style the progress bar. Make sure to add appropriate CSS styles for these classes.
    • The width of the progress bar is determined based on the current question's index (next) and the total number of questions (len).
    • The progress bar is a visual representation of how far the user has progressed in the quiz.

These enhancements improve the user experience of the quiz by adding a time limit per question and a visual indicator of progress. Users can see how much time is remaining for each question and how far they have progressed in the quiz.

netlify[bot] commented 12 months ago

Deploy Preview for ask-quiz failed.

Name Link
Latest commit e352dd99cccd7d3ac017cd5d9832e3502a46c5ff
Latest deploy log https://app.netlify.com/sites/ask-quiz/deploys/65202e3c388fde00086ff722
imhardikdesai commented 12 months ago

Hello @rishi457 , please refer this deployment log