-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
43 lines (37 loc) · 903 Bytes
/
app.js
File metadata and controls
43 lines (37 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* eslint-env browser */
/* eslint-disable jsx-a11y/label-has-for */
import React from 'react';
import ReactDOM from 'react-dom';
class MainApp extends React.Component {
constructor(props) {
super(props);
this.state = {
large: true,
};
this.handleChange = this.handleChange.bind(this);
}
handleChange(event) {
this.setState({
large: event.target.checked,
});
}
render() {
const { large } = this.state;
return (
<div>
<p>
<label htmlFor="size">
<input id="size" type="checkbox" checked={large} onChange={this.handleChange} />
<span>Large iframe</span>
</label>
</p>
<iframe
width={large ? 800 : 500}
title="demo iframe"
src="frame.html"
/>
</div>
);
}
}
ReactDOM.render(<MainApp />, document.getElementById('example'));