-
-
Notifications
You must be signed in to change notification settings - Fork 181
Closed as not planned
Description
Description:
When scrolling down, the navbar shrinks in size, but the transition is not smooth. It appears to be laggy, possibly due to excessive re-renders or inefficient event handling.
Steps to Reproduce:
- Scroll down the page to trigger the navbar resize.
- Observe the navbar shrinking behavior.
- Notice that the transition is not smooth, and the navbar may feel jittery or unresponsive.
Expected Behavior:
The navbar should shrink smoothly without any noticeable lag or abrupt jumps.
Possible Causes:
- Too many state updates causing re-renders.
- Inefficient handling of scroll events.
- Lack of proper CSS transitions for smooth resizing.
Suggested Fixes:
✅ Optimize Scroll Event Handling:
- Use throttling or debouncing to limit the number of state updates.
- Consider using
useRefinstead ofuseStateto avoid unnecessary re-renders.
✅ Improve CSS Transitions:
- Ensure that the navbar height change is animated smoothly using
transition: height 0.3s ease-in-out;.
Proof:
2025-02-28.00-50-35.mp4
Metadata
Metadata
Assignees
Labels
No labels