Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Home.jsx #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

rishi457
Copy link
Contributor

@rishi457 rishi457 commented Oct 7, 2023

Error Handling:

We added a new state variable error using useState to handle errors that may occur during the API request for fetching questions. Inside the handleSubmit function, we wrapped the API request in a try-catch block to catch any potential errors. If an error occurs during the API request, we set the error state with an error message to inform the user. We added a conditional rendering block to display the error message in red if error is not null. Feedback for Loading:

We provided feedback to the user during the loading process by using the HashLoader component from 'react-spinners' to display a loading spinner. The loading spinner is displayed in the center of the screen while questions are being fetched. The loading state is controlled by the loading state variable from the context. Improved Styling and Layout:

We made minor styling improvements, such as centering text and the loading spinner on the screen. We used Chakra UI's Text component to style and display the error message in red if there is an error. User-Friendly Error Message:

In the error message, we provide a user-friendly error message, such as "Failed to fetch questions. Please try again," to inform the user about the issue. These changes enhance the user experience by providing better feedback during loading and handling errors gracefully when fetching questions from the API.

Error Handling:

We added a new state variable error using useState to handle errors that may occur during the API request for fetching questions.
Inside the handleSubmit function, we wrapped the API request in a try-catch block to catch any potential errors.
If an error occurs during the API request, we set the error state with an error message to inform the user.
We added a conditional rendering block to display the error message in red if error is not null.
Feedback for Loading:

We provided feedback to the user during the loading process by using the HashLoader component from 'react-spinners' to display a loading spinner.
The loading spinner is displayed in the center of the screen while questions are being fetched.
The loading state is controlled by the loading state variable from the context.
Improved Styling and Layout:

We made minor styling improvements, such as centering text and the loading spinner on the screen.
We used Chakra UI's Text component to style and display the error message in red if there is an error.
User-Friendly Error Message:

In the error message, we provide a user-friendly error message, such as "Failed to fetch questions. Please try again," to inform the user about the issue.
These changes enhance the user experience by providing better feedback during loading and handling errors gracefully when fetching questions from the API.
@netlify
Copy link

netlify bot commented Oct 7, 2023

Deploy Preview for ask-quiz ready!

Name Link
🔨 Latest commit 34cc2e6
🔍 Latest deploy log https://app.netlify.com/sites/ask-quiz/deploys/6521642d48989c000867ce50
😎 Deploy Preview https://deploy-preview-8--ask-quiz.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@imhardikdesai
Copy link
Owner

@rishi457 Deployment is not working can you solve error

Copy link
Owner

@imhardikdesai imhardikdesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check deployed preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants