📜  将 setstate 传递给子级 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:11.608000             🧑  作者: Mango

代码示例1
//ChildExt component
class ChildExt extends React.Component {
    render() {
        return (
)} } //Parent component class ParentExt extends React.Component { constructor(props){ super(props); this.state = {lol: false } } handleForUpdate(someArg){ this.setState({lol: true}); console.log(someArg); } //Notice how we don't pass the arguments into the bind.this even though it does take an argument. render() { return () } }