jakezatecky / react-checkbox-tree

A simple and elegant checkbox tree for React.

Home Page:https://jakezatecky.github.io/react-checkbox-tree/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get ID

mftlhn opened this issue · comments

How can I get the ID of the checkbox I checked. It's just the checkbox I'm checking. Not all the checkboxes have been checked?

The second parameter of the onCheck function function is the node the triggered the check. E.g.:

const onCheck = (checked, targetNode) => {
  console.log(targetNode.value);
};

return (
  <CheckboxTree
    ...
    onCheck={onCheck}
  />
);

thanks it works