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

Optimize useEffect hooks in the VideoPlayer component #400

Closed
wants to merge 3 commits into from

Conversation

TanmayDhobale
Copy link
Contributor

PR Fixes:

VideoPlayer component, there were multiple useEffect hooks being used for different purposes, such as initializing the video player, updating the player's state based on props or query parameters, handling video progress, and cleanup. Having multiple useEffect hooks can lead to code duplication, increased complexity, and potential performance issues.

To address this, we refactored the code to use a single useEffect hook that combines all the necessary logic and functionality. By consolidating the logic into a single hook, we achieved the following benefits:

  1. Code Simplification: Instead of managing multiple useEffect hooks with different dependencies, we now have a single hook that encapsulates all the necessary logic. This makes the code easier to read, understand, and maintain.

  2. Improved Performance: By combining all the logic into a single useEffect hook, we ensure that the effect is only running when one of its dependencies changes. This can potentially improve performance by reducing unnecessary re-renders and computations.

By optimizing the useEffect hooks in the VideoPlayer component, we've improved the code quality, readability, and potentially the performance of the component. This refactoring demonstrates a commitment to writing clean, maintainable, and efficient code.

Checklist before requesting a review

  • I have performed a self-review of my code
  • I assure there is no similar/duplicate pull request regarding same issue

@hkirat
Copy link
Contributor

hkirat commented May 12, 2024

too many merge conflicts, can u create it again?

@hkirat hkirat closed this May 12, 2024
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