I am trying to make a selection system with checkboxes including a master checkbox on the top of the table. I am facing a problem with selection. Only the master toggle is working and others are not working. Actually, the code is running and a selected log is updating but UI is not updating. Please help me.
Here is codesandbox link: link
import TableHead from "./Table_Head";
import TableContent from "./Table_Content";
import Paginator from "./Paginator";
import TopAction from "./Top_Action";
import FilterMenu from "./Filter_Menu";
import UserDetail from "./User_Detail";
import "./Table.css";
import { useState, useRef, useEffect } from "react";
import Users from "./Data";
const TableMaker = (props) => {
  return (
    <TableContent
      keyVal={props.data.sn}
      Full_Name={props.data.Full_Name}
      User_Id={props.data.User_Id}
      Points={props.data.Points}
      Status={props.data.Status}
      updateSelectLog={() => props.updateSelectLog()}
      isSelected={props.isSelected}
    />
  );
};
export default function Table() {
  const selectLog = useRef([]);
  const selAll = useRef(false);
  console.log("first array ", selectLog.current);
  selectLog.current.length === 0
    ? Users.forEach((i) => selectLog.current.push(false))
    : console.log("already added");
  const [log, setLog] = useState(selectLog.current);
  // console.log("log: ", selectLog.current, log);
  //useEffect(() => {}, []); // set the selection log at start
  const updateSelectLog = (i) => {
    console.log("clicked button: ", i);
    if (i !== "master") {
      let t = selectLog.current;
      t[i] = !t[i];
      console.log("changed value: ", selectLog.current[i]);
      setLog(t);
    } else {
      selAll.current = !selAll.current;
      selectLog.current = selectLog.current.map(() => selAll.current);
      setLog(selectLog.current);
    }
  };
  const isAllSelected = () => {
    console.log("is all selected", log);
    return log.indexOf(false) === -1 ? true : false;
  };
  // const isSelected=(i)=>log[i];
  return (
    <>
      <div className="Table_Container">
        {/* <FilterMenu/> */}
        {/* <TopAction /> */}
        <TableHead
          updateSelectLog={() => updateSelectLog("master")}
          isAllSelected={isAllSelected()}
        />
        {Users.map((i) => (
          <TableMaker
            key={i.sn}
            data={i}
            isSelected={log[i.sn]}
            updateSelectLog={() => {
              updateSelectLog(i.sn);
            }}
          />
        ))}
        {/* <Paginator /> */}
        {/* <UserDetail/> */}
      </div>
    </>
  );
}
 
     
     
    