-
Notifications
You must be signed in to change notification settings - Fork 2
Allow for External Dropdown State Control #215
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
base: main
Are you sure you want to change the base?
Conversation
…ow an example of it
* Add options prop table
|
Please set a versioning label of either |
|
Remove internal state per previous discussion, pass in props |
jbkolze
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a comment on defaultValue. Looks good otherwise.
| className, | ||
| )} | ||
| value={value} | ||
| defaultValue={defaultValue} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the component is intended to be React-controlled I don't think we'd want to include a defaultValue. The default value would be handled by the useState hook for the variable being provided to value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intend to include this modal formatting in this PR?
Talking with @jbkolze he needed to be able to control dropdowns from outside the dropdown component.
This PR shows how that could be done while also maintaining a default of dropdowns state management for you. If you do not handle state by default, when value is not provided, this will break backwards compatibility. (Major Bump)
Documentation was updated to show both scenarios.
Marking as draft pending a larger conversation of not handling state in GW components.