conditional rendering with radio buttons
class RadioButtonsGroup extends React.Component {
state = {
value: 1
};
handlePersonToggle = event => {
// console.log(typeof event.target.value) //string
this.setState({ value: event.target.value });
};
render() {
const { classes } = this.props;
return (
<RadioGroup
aria-label="matches"
name="matches"
value={String(this.state.value)}
>
{data.map(person => {
return (
<FormControlLabel
onClick={e => this.handlePersonToggle(e)}
key={String(person.Id)}
value={String(person.Id)}
control={<Radio color="primary" />}
label={
<div>
{this.state.value == person.Id ? <div>if true show</div> : ""}
</div>
}
/>
);
})}
</RadioGroup>
);
}
}
Also in JavaScript:
- create eventlistener to close webpage js
- javascript filter array by groups of highest
- navigation.openDrawer is not a function react native
- vue deep watch
- js add src to img
- how to cut off decimals in javascript
- js any array
- react responsive video player
- Vue Chartjs label false
- remove duplicates array javascript
- express js list all routes
- js get timezone name
- tab semantic ui react
- react dom
- js errors
- json serializer skip property
- external css not working in jsp
- javascript random six digit number with animation
- crypto nodejs
- set readonly in javascript
- ajax calls
- javascript toFixed
- json identifier with period
- node to viewport godot