0% found this document useful (0 votes)
136 views

Learning React

This code handles deleting a counter from the counters state by filtering the counters array to remove any counter with a matching id, and then updating the state with the filtered counters array.

Uploaded by

Wasiq Karim
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views

Learning React

This code handles deleting a counter from the counters state by filtering the counters array to remove any counter with a matching id, and then updating the state with the filtered counters array.

Uploaded by

Wasiq Karim
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Delete button Code

handleDelete = counterId => {


const counters = this.state.counters.filter(c => c.id !== counterId);
this.setState({ counters });
};

You might also like