vendredi 15 février 2019

on select multiple check boxes get all values using ReactJs with BootstrapUI

Code below is to get selected values(Like a search refinement/search ). For Example, If I click on the Political Checkbox, I should get Political Value If I click on the MovieCheckbox, I should get MovieValue as well as Political Value If I uncheck It should display only selected checkbox value. Below is the code which I have written

class Refinments extends Component {
    render(){
    const { handleChange,handleClick } = this.props;
    return(
    <Form>
       {['checkbox'].map(type => (
            <div key={`Political`} className="mb-1">
              <Form.Check 
                type={type}
                custom 
                id={`Political}`}
                label={`Political`}
                value={`Political`}
                onChange={handleChange.bind(this, "Political")}
              />
            </div>
        ))}
        {['checkbox'].map(type => (
            <div key={`movies`} className="mb-1">
              <Form.Check 
            type={type} custom
            id={`movies}`}
            label={`Movies`}
            value={`Movies`}
             onChange={handleChange.bind(this, "Movies")}
              />
            </div>
        ))}
     </Form>
     )}

export default Refinments;




Aucun commentaire:

Enregistrer un commentaire