1
votes
<button
                      type="button"
                      className="btn"
                      style={{ background: "#C620A7", color: "white" }}
                      onClick = "{(e)=>postDelete(value.id,e)} ;  *function* "
                    >
                      Delete task
                    </button>

// onclick has two functions one is postdelete and the other function I want to change the color ? need the code how to change the style and change the background color

1

1 Answers

0
votes
const [bgColor , setBgColor] = useState("#C620A7")

<button                
      type="button"
      className="btn"
      style={{ background: bgColor, color: "white" }}
      onClick = {(e)=>{
                  postDelete(value.id,e); 
                  setBgColor('yellow')}
      } ;  
 >
  Delete task