score:0

Accepted answer
class parentcomponent extends component {
    passedfunction = () => {}
    render() {
      <childcomponent passedfunction={this.passedfunction}/>
    }
}


class childcomponent extends component {
    render() {
        <div onclick={this.props.passedfunction}></div>
    }
}

you can use arrow function to avoid all the bindings. if you want to bind it, bind it in the constructor like so... in the parent component.

constructor() {
        this.passedfunction = this.passedfunction.bind(this)
    }

<childcomponent passedfunction={this.passedfunction}/>

i could see that, in your child component you are using :

update(){
       console.log("updating...");
       this.props.updatecolumn("test","test");
   }

but your props for that function is colupdate i.e. you should be using

update(){
           console.log("updating...");
          this.porps.colupdate("test","test");
       }

hope this helps!


Related Query

More Query from same tag