handleChange = e => { const { codeCoverage } = this.state; // Find the value selected the codeCoverage array const index = codeCoverage.indexOf(e.target.value); // If the value is not found then add it to the array if (index === -1) codeCoverage.push(e.target.value); // If value found then remove the value to unselect else codeCoverage.splice(index,1); // Set the state so that the component reloads with the new value this.setState({ codeCoverage: [...codeCoverage] }); };