Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

individual checkbox remains selected even after the state change #16

Open
chandandas opened this issue Aug 17, 2020 · 1 comment
Open

Comments

@chandandas
Copy link

chandandas commented Aug 17, 2020

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>
@AlexLisenkov
Copy link
Member

Can you create a codesandbox showing the bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants