-
Notifications
You must be signed in to change notification settings - Fork 270
Closed
Description
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 ?