Skip to content

individual checkbox remains selected even after the state change #16

@chandandas

Description

@chandandas

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions