grouped-checkboxes icon indicating copy to clipboard operation
grouped-checkboxes copied to clipboard

individual checkbox remains selected even after the state change

Open chandandas opened this issue 5 years ago • 1 comments

The below is the snippet.

there is term list, when user selects a term, the below component is called and a new term details is passed. But the issue is , if i have selected a checkbox for term1 and the same checkbox remain selected for term2 and so on as well.

Please help. I am state inside class component.

const Sentences = ({term,onCheckboxChanged})=>(

<CheckboxGroup onChange={onCheckboxChanged}  >
    <table>
        <thead>
            <tr>
                <th width="5%" className="text-center"> <AllCheckerCheckbox /></th>
                <th>All</th>
            </tr>
        </thead>  
        <tbody>
            {term.sentences.map((sentence,index) =>
                <tr>
                    <td className="text-center align-top"><Checkbox className="checkbox" value={index} /></td>
                    <td>{sentence}</td>
                </tr>
            )}
           
        </tbody>
</table>

chandandas avatar Aug 17 '20 12:08 chandandas

Can you create a codesandbox showing the bug?

AlexLisenkov avatar Aug 19 '20 06:08 AlexLisenkov