-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathindex.js
36 lines (29 loc) · 811 Bytes
/
index.js
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
import React, {Component} from 'react'
import {render} from 'react-dom'
import Gist from '../../src'
class Demo extends Component {
constructor(props) {
super(props);
this.state = {
id: 'bedde975e6e92a77e2321487ba45f313',
file: null
};
}
componentDidMount() {
// update the gist after 5 seconds
setTimeout(() => {
this.setState({id: '5995ea726914f280afb3', file: 'Chef-Dockerfile'});
}, 5000);
setTimeout(() => {
this.setState({id: null, file: null, url: 'https://gist.github.com/ringods/5995ea726914f280afb3'});
}, 10000);
}
render() {
return <div>
<h1>React-Gist</h1>
<p>The following gist will be updated in 5 seconds</p>
<Gist {...this.state} />
</div>
}
}
render(<Demo/>, document.querySelector('#demo'))