this.state.onlyvar.TheName显示为undefined,我不知道为什么。
import React, { Component } from 'react';
class Thevar extends Component {
constructor(props) {
super(props);
this.state = {
onlyvar: [{
TheName:"getter Name"
}]
}
}
render() {
return (
<div>
TheOnlyVar: <p>{console.log(this.state.onlyvar.TheName)}</p>
</div>
)
}
}
export default Thevar;
肥皂起泡泡
相关分类