() => { const values = ['Jacksonʼs chameleon', 'Peacock Chameleon', 'Panther Chameleon']; const [checkedValue, setCheckedValue] = React.useState(values[0]); const isChecked = value => value === checkedValue; return ( <Fieldset label="Which chameleon species gives birth to live young?" optionalLabel={props.optionalLabel} message={props.message} disabled={props.disabled} > {values.map(value => ( <div key={value} style={{marginBottom: '10px'}}> <Radio name="chameleons" id={`label-${value}`} value={value} label={value} checked={isChecked(value)} disabled={props.disabled} onChange={e => setCheckedValue(e.target.value)} /> </div> ))} </Fieldset> ); };