Skip to content

Correct way to represpen close state of controlled Navigation Menu #2124

Answered by benoitgrelard
QzCurious asked this question in Help
Discussion options

You must be logged in to vote

But since it is controlled, for react, value should not be undefined. It also makes it unclear what should NavigationMenu.Root do for setOpeningMenu(undefined).

Yes that's correct. Controlling it and setting it back to undefined is essentially trying to set it back to "uncontrolled" so should be avoided. The same is true for any component in React (ie. the same is true with native input for example and React will actually warn you if you do this).

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@QzCurious
Comment options

Answer selected by QzCurious
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants