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

Performance Enhancements and Best Practices Implementation ✈ #42

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

Conversation

sanjaiyan-dev
Copy link

Hi, this PR introduces performance improvements and incorporates some best practices.

  1. Change setState functions to update using callbacks. For example, instead of setShowRoomSettings(!showRoomSettings));, use setShowRoomSettings((prevShowRoomSettings) => !prevShowRoomSettings);. This change helps with automatic batching (as recommended in React 18) and is advised by the React JS team itself. For more information, please refer to the following links:

  2. Moved independent functions outside the component, which reduces unnecessary memory usage, as their references won't change whenever the component updates.

  3. Add decoding="async" to the img tag, which makes the development tool load faster and feel more responsive.

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

Successfully merging this pull request may close these issues.

2 participants