/
index.js
57 lines (48 loc) · 1.24 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React from "react";
import ReactDOM from "react-dom";
import spdf from "simple-react-pdf";
// sample page content
class App extends React.Component {
render() {
return (
<div>
<spdf.SimplePDF file="./example2.pdf"/>
<spdf.SimplePDF file="./example1.pdf"/>
<spdf.SimplePDF file="./example2.pdf"/>
</div>
);
}
}
ReactDOM.render( <App/>, document.getElementById('app') );
// sample page content with update
/*
class App extends React.Component {
constructor() {
super();
this.load1 = this.load1.bind(this);
this.load2 = this.load2.bind(this);
this.state = { filename: "./example1.pdf" };
}
load1() {
this.state.filename = "./example1.pdf";
this.forceUpdate();
}
load2() {
this.state.filename = "./example2.pdf";
this.forceUpdate();
}
render() {
return (
<div>
<spdf.SimplePDF file={this.state.filename}/>
<spdf.SimplePDF file={this.state.filename}/>
<spdf.SimplePDF file={this.state.filename}/>
<br/>
<button onClick={this.load1}>load example1.pdf</button>
<button onClick={this.load2}>load example2.pdf</button>
</div>
);
}
}
ReactDOM.render( <App/>, document.getElementById('app') );
*/