-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHello.js
More file actions
35 lines (31 loc) · 766 Bytes
/
Hello.js
File metadata and controls
35 lines (31 loc) · 766 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
import React from 'react';
import fetch from 'isomorphic-fetch';
import s from 'Hello.scss'
import PropsTypes from 'prop-types'
class Hello extends React.Component{
constructor(props) {
super(props)
}
static fetchData() {
return fetch('http://localhost:3000/static/data.json')
.then(r => r.json())
.then(r => {
return { hello: r.hello }
})
}
handleClick() {
console.log('start--------click')
}
render() {
const { hello } = this.props
return <div className={s.root}>
<button onClick={this.handleClick}>点这里</button>
Hello {hello}. Async hello {hello}
{ this.props.children }
</div>
}
}
// Hello.childContextTypes = {
// datas: PropsTypes.object,
// }
export default Hello