【发布时间】:2017-04-13 17:54:55
【问题描述】:
我是 react.js 的新手,我正在尝试在表中以 JSON 格式获取服务器端数据。所以我做的是:
export default class TableUser extends React.Component {
constructor(props) {
super(props);
this.state = {
table: [],
}
}
componentDidMount(){
axios.get('http://www.reddit.com/r/reactjs.json')
.then((response)=>{
const table = response.data.map(obj => obj.data);
this.setState({ table });
})
.catch((err)=>{
})
}
我在<div> 中呈现这个,比如:
render(){
<div><p>{this.state.table.kind}</p></div>
}
为什么我没有得到kind 的价值?
请推荐!!
【问题讨论】: