title: Way to determine checkbox checked in react (useState)
body: <p>This is my first time to develop a react application. I tried to implement checkboxes in each row of a table and check which of the rows are selected.</p>
  
  <p>I used <code>useState</code> hook to make checked and onChange events, but seems the values are not refreshing when I check then uncheck the checkbox. </p>
  
  <p>I would like to ask how to add a logic to remove the unticked values on the hooks.</p>
  
  <p>T1
  Checkbox A- Checked
  Checkbox B- Checked
  CheckedMap- A,B</p>
  
  <p>T2
  Checkbox B- Unchecked
  CheckedMap- A,B // Unticked Checkbox B is also stored in CheckedMap</p>
  
  <p>Thank you for your help.</p>
  
  <pre><code>export default function({ infinite }) {
    const [checkedMap, setCheckedMap] = useState(new Map());
  }
  
  const handleCheckedChange = transaction_seq =&gt; {
      let modifiedMap = checkedMap;
      modifiedMap.set(transaction_seq, !checkedMap.get(transaction_seq));
      setCheckedMap(modifiedMap);
    };
  
  const columns = [
      {
        Header: "Transaction(s)",
        className: "left",
        columns: [
          {
            id: "checkbox",
            accessor: "checkbox",
            Cell: ({ row }) =&gt; {
              return (
                &lt;input
                  type="checkbox"
                  className="checkbox"
                  checked={checkedMap.get(row.original.transaction_seq)}
                  onChange={() =&gt;
                    handleCheckedChange(row.original.transaction_seq)
                  }
  </code></pre>