-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathmain.js
More file actions
38 lines (33 loc) · 881 Bytes
/
main.js
File metadata and controls
38 lines (33 loc) · 881 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
// Data to pass to our List elements
class Demos extends React.Component {
constructor(props) {
super(props);
this.state = {
demos: []
};
}
componentDidMount() {
d3.csv('data/demos.csv', (data) => {
this.setState({ demos: data });
});
}
render() {
return (
<div>
{this.state.demos.map(function (d, i) {
return (
<div key={'demo-' + i}>
<h3><a href={d.title}>{d.title}</a></h3>
<p>{d.description}
</p>
</div>
)
})}
</div>
);
}
}
// Render your component in the `main` section
ReactDOM.render(<Demos />,
document.querySelector('#examples')
);