alexa

How to keep the last component styles in react.js ?

How to keep the last component styles in react.js ?

Your problem is in position of your delete button, that wrapped by div with makrComplete handler, so then you click on your delete button, markComplete fired too, so your isComplete changed and styles deleted. To prevent this behavor, you can do a little trick with prevent default. So, try to wrap your deleteTaskHandler in another function like that:

 const deleteButtonClickHandler = (e) => {
    e.preventDefault();
    e.stopPropagation();

    deleteTaskHandler(id)
} 

and your delete button makrdown should be look like this:

 <button onClick={deleteButtonClickHandler}> Delete </button>

215 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry