▶app.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
|
import React,{Component} from 'react'
import axios from 'axios'
class App extends Component{
constructor(props) {
super(props);
this.state={
recipe:[],
detail:{},
totalpage:1,
page:1
}
}
componentDidMount() {
axios("http://localhost/web/recipe/list.do",{
params:{
page:1
}
}).then(response=>{
this.setState({recipe:response.data})
})
}
render() {
const html=this.state.recipe.map(m=>
<div className="col-md-3">
<div className="thumbnail">
<img src={m.poster} alt="Lights" style={{"width":"100%"}}/>
<div className="caption">
<p>{m.title}</p>
</div>
</div>
</div>
)
return(
<div className={"row"}>
{html}
</div>
)
}
}
export default App;
|
cs |
하단 Terminal 탭에서 npm start를 입력하면 링크 주소가 뜬다. 클릭!
댓글