When clicking a link in the mobile menu, the menu doesn't close automatically because Next.js only re-renders components that have changed. To close the menu on navigation, we pass the onToggle function to the link components and call it onClick, triggering a state change and re-render of the menu.
How Has This Been Tested?
Local dev and storybook.
Types of changes
[X] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[X] I have read the Contributing guide.
[X] My code/comments/docs fully adhere to the Code of Conduct.
[X] My change is a code change.
[ ] My change is a documentation change and there are NO other updates required.
Description / Motivation
When clicking a link in the mobile menu, the menu doesn't close automatically because Next.js only re-renders components that have changed. To close the menu on navigation, we pass the onToggle function to the link components and call it onClick, triggering a state change and re-render of the menu.
How Has This Been Tested?
Local dev and storybook.
Types of changes
Checklist: