-
Notifications
You must be signed in to change notification settings - Fork 60
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
Frontend setup & UI Implementation. #3
base: main
Are you sure you want to change the base?
Conversation
import React from "react"; | ||
|
||
class ErrorBoundary extends React.Component { | ||
constructor(props) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why is this ErrorBoundary alone using class component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although a functional component could handle this task, I chose to implement it using a class component for simplicity and to utilize lifecycle methods like componentDidCatch
and getDerivedStateFromError
. While functional component solutions exist, such as those involving third-party libraries like 'react-error-boundary' or utilizing hooks like useEffect
and event listeners, I find the class component approach simpler and more straightforward for error boundary management.
Great Work 🎉 - @hopansh |
Thanks @piyushgarg-dev 🫠🤗 |
@hopansh Can you please add the API and Socket Integration as well? You can use this code for reference https://github.com/piyushgarg-dev/vercel-clone/blob/8a69988450aefef68ebf8704caa6718ec666d3b4/frontend-nextjs/app/page.tsx Deployment Trigger Code vercel-clone/frontend-nextjs/app/page.tsx Lines 36 to 52 in 8a69988
Here is the video that might help you https://imgur.com/I6KgmNR Thanks :) |
Sure. 🫡 Will push the changes. |
Changes:
Known Issues and Future Scope:
|
Awesome @hopansh 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we shouldn't wrap whole application in a single ErrorBoundary, instead chunks of components should be wrapped in them. @hopansh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your suggestion! It's indeed a valid consideration to implement error boundaries at the component level, especially when dealing with multiple components on the screen where the failure of one doesn't significantly affect the overall product value. However, in our specific scenario where only a limited number of components are present at any given time and the failure of any of them results in the failure of the entire flow or product, wrapping the entire application in a single ErrorBoundary offers a more comprehensive approach to error handling.
While implementing component-level error boundaries is a valid approach in certain scenarios, in this context, a holistic error boundary strategy at the application is more effective solution for ensuring the stability and reliability of our product in my view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing 🎉
The frontend project uses the following dependencies:
Future Scope:
For More Info: Please refer to Readme.md