Controlled checkbox in React

I’m trying to put all checked checkboxes in the state array. I am able to add values to the array, but I cannot delete the value when I uncheck the box. I’ve tried using splice and delete by index, also tried deleting through a filter. It …

State not updating on button Click

I am new to react. I have 3 buttons in my components and I am applying a class active based on the selection.(i.e button that is clicked ).
Code is,
import React, { useState, useEffect } from ‘react’;
import PropTypes from ‘prop-types’;