var requiredFieldWarningStyle = { color: '#cc0000', transition: 'opacity 400ms ease-in', }; var FormField = React.createClass({ _type: null, _element: null, propTypes: { type: React.PropTypes.string.isRequired, hidden: React.PropTypes.bool, }, getInitialState: function() { return { warningState: 'hidden', } }, componentWillMount: function() { if (['text', 'radio', 'checkbox', 'file'].indexOf(this.props.type) != -1) { this._element = 'input'; this._type = this.props.type; } else { // Non field, e.g.