Skip to content

Instantly share code, notes, and snippets.

@agoiabel
Created September 4, 2018 17:43
Show Gist options
  • Select an option

  • Save agoiabel/580ea12e6caf75848d18b8c2a1ff7ca6 to your computer and use it in GitHub Desktop.

Select an option

Save agoiabel/580ea12e6caf75848d18b8c2a1ff7ca6 to your computer and use it in GitHub Desktop.
import React from 'react';
const Radio = props => {
let formControl = "form-control";
if (props.touched && !props.valid) {
formControl = 'form-control control-error';
}
return (
<div className="form-group">
{props.options.map(option => (
<div className="form-group" key={option.value}>
<label>{option.displayValue}</label>
<input type="radio"
name={props.name}
value={option.value}
onChange={props.onChange}
className={formControl}
/>
</div>
))}
</div>
);
}
export default Radio;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment