普通组件这样传参
class Home extends Component {
constructor(props) {
super(props)
}
doSomething() {
}
render() {
return (
<div>
<Child onDoSomething={this.doSomething} />
</div>
);
}
}
如果组件被弄到路由里面了,那Home组件怎么把doSomething传递给Child调用呢?(redux我知道,想知道不用redux,怎么传递)
class Home extends Component {
constructor(props) {
super(props)
}
doSomething() {
}
render() {
return (
<div>
<Route path="/child" component={Child} />
</div>
);
}
}
拉风的咖菲猫
皈依舞
相关分类