Originally, I was using react-hook-form to manage the Select component, but I found that if I directly used from.setValue() to set the value of the Select, the Select component would not show the item selected.
Through react devtools, I found that the value prop of the Select component was indeed modified, but it did not show that the item was selected, and when submitting the form, it still prompted that the Select was empty. In addition, I found that state.selectedKeys in HiddenSelect was also empty.
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Here is a simple example that can reproduce the bug
NextUI Version
2.4.8
Describe the bug
Originally, I was using
react-hook-form
to manage the Select component, but I found that if I directly usedfrom.setValue()
to set the value of the Select, the Select component would not show the item selected.Through
react devtools
, I found that thevalue prop
of the Select component was indeed modified, but it did not show that the item was selected, and when submitting the form, it still prompted that theSelect
was empty. In addition, I found thatstate.selectedKeys
inHiddenSelect
was also empty.Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Here is a simple example that can reproduce the bug
Expected behavior
Theoretically the value of Select will be modified, and the selection box will show that it is selected.
Screenshots or Videos
After clicking the button, the value of Select does change, but the Select component does not show that it is selected.
Operating System Version
Windows
Browser
Chrome