Skip to content

Any logic in handleChange is  #445

@RaedMou

Description

@RaedMou

Describe the bug
I just want to save the selected nodes in a new state using hook component :

`
const handleChange = ({ value, checked, type }, selectedNodes) => {
if (value === "selectAll") {
if (checked) setSelectedBooks(["All"])
else setSelectedBooks([])
toggleAll(checked);
}

if (type === "book" && checked) setSelectedBooks(state => [...state, value])
if (type === "book" && !checked) setSelectedBooks(selectedBooks.filter(item => item !== value))

console.log("Selected : ", selectedNodes)

};`

To Reproduce

Now the "selectedNodes" is only one value and doesn't save other selections , only stores the last one.

Is there a way to add my logic in handleChange ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions