0% found this document useful (0 votes)
145 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
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 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
We take content rights seriously. If you suspect this is your content, claim it here.
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