Using Filter On 'this' In Reactjs
So this is my parent class class ComponentStart extends Component { constructor() { super(); this.count = 0; this.state = {}; this.repea
Solution 1:
You're comparing React elements that you create:
this.repeats.push(<StartMultiple ... delete_this={this.delete_this.bind(this)}/>);
to index
, which will be this
, which is the instance of ComponentStart
this.repeats = this.repeats.filter( (item) => item != index );
this
isn't what you expect, but don't look up elements in an array by React instance checking. Remove items from an array with data only, such as comparing an ID or an index in the array.
Post a Comment for "Using Filter On 'this' In Reactjs"