-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
chore(Dropdown): add props for semantic settings #147
Conversation
@@ -39,7 +124,7 @@ export default class Dropdown extends Component { | |||
|
|||
render() { | |||
const options = _.map(this.props.options, (opt, i) => { | |||
return <option key={i} value={opt.value}>{opt.text}</option>; | |||
return <option key={opt.value} value={opt.value}>{opt.text}</option>; |
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.
Minor fix while I'm in here, index as key is a risky anti-pattern, and since the value
is a string value we can just use that as the key.
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.
I swear React used to throw warnings in the console for this and then stopped. Not sure why they stopped.
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.
Only warns if key is missing, there is no way for React to know if it is an index or a real key.
🍂 |
🉑 |
maxSelections: this.props.maxSelections, | ||
on: this.props.on, | ||
placeholder: this.props.placeholder, | ||
saveRemoveData: this.props.saveRemoteData, |
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.
Looking at Dropdown Settings - Remote Settings this defaults to true, meaning form values persist to session storage. Though I haven't actually seen it function yet, it'd be nice to have in the future.
💫 |
No description provided.