我试图在 props 的帮助下从其他组件中获取价值,但它不起作用。
这是我的逻辑
main.js 向 child.js 组件发出请求,在 child.js 中我变老了,但它不起作用。
class Main Connect extends Component {
constructor(props) {
this.age = this.props.age
}
render() {
<Child />
return(this.age)
}
}
class Child Connect extends Component {
render()
return(<Main age='21' />)
}
慕尼黑8549860
慕妹3146593
相关分类