1class App extends React.Component {
2 constructor(props) {
3 super(props);
4 this.state = {};
5 }
6
7 handleChange = e => {
8 const { name, value } = e.target;
9
10 this.setState({
11 [name]: value
12 });
13 };
14
15 render() {
16 return (
17 <div className="radio-buttons">
18 Windows
19 <input
20 id="windows"
21 value="windows"
22 name="platform"
23 type="radio"
24 onChange={this.handleChange}
25 />
26 Mac
27 <input
28 id="mac"
29 value="mac"
30 name="platform"
31 type="radio"
32 onChange={this.handleChange}
33 />
34 Linux
35 <input
36 id="linux"
37 value="linux"
38 name="platform"
39 type="radio"
40 onChange={this.handleChange}
41 />
42 </div>
43 );
44 }
45}