Skip to content
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

Add class and "selected" attribute capabilities to option element #35

Merged
merged 1 commit into from
Dec 9, 2015

Conversation

rjatkinson2
Copy link
Contributor

No description provided.

twisty added a commit that referenced this pull request Dec 9, 2015
Add class and "selected" attribute capabilities to option element.
@twisty twisty merged commit 295cb94 into twisty:master Dec 9, 2015
@twisty
Copy link
Owner

twisty commented Dec 9, 2015

Thanks for the PR, will make a minor release later in the week.

@twisty
Copy link
Owner

twisty commented Dec 10, 2015

Note: I think passing the selected attribute will only work for uncontrolled components.

For controlled components, simply setting the value of the select should add selected to the correct option elements for you (value should be an array for a multiple select).

@twisty
Copy link
Owner

twisty commented Dec 10, 2015

Note: while it's now possible to add selected to option elements, it isn't encouraged. React will issue this warning:

Warning: Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants