react.js call parent function from child

前端 未结 3 2091
小蘑菇
小蘑菇 2021-01-12 02:16

I know there are a few similar questions here and here but I am having a tough time understanding what is the correct thinking today on this and extrapolating it to my situa

3条回答
  •  逝去的感伤
    2021-01-12 02:37

    You should pass handleScoreRemove as a prop to Score:

    In ScoreList:

    var scoreNodes = this.props.data.map(function(score) {
      return (
        
        
      );
    });
    

    In Score:

    removeRecord: function(e){
      this.props.handleScoreRemove(this);
    }
    

提交回复
热议问题