Skip to content

Instantly share code, notes, and snippets.

@nicklaw5
Created July 19, 2017 19:25
Show Gist options
  • Save nicklaw5/176066c37de13eb5e301703aa2bda188 to your computer and use it in GitHub Desktop.
Save nicklaw5/176066c37de13eb5e301703aa2bda188 to your computer and use it in GitHub Desktop.
SelectFormGroup.js
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Select from '../elements/Select'
class SelectFormGroup extends Component {
constructor(props) {
super(props)
this.state = {
name: this.props.name,
label: this.props.label,
}
}
render() {
return (
<div className="form-group">
<label htmlFor={this.state.name}>{this.state.label}</label>
<Select {...this.props} />
</div>
)
}
}
SelectFormGroup.propTypes = {
name: PropTypes.string,
label: PropTypes.string,
}
SelectFormGroup.defaultProps = {
name: 'select',
label: 'Select Label:',
}
export default SelectFormGroup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment