Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const [checkedBoxesDate, setCheckedBoxesDate] = useState([]);
- // 1. Działa
- const handleCheckBoxDate = (position1, position2) => {
- const chkBoxesCopy = JSON.parse(JSON.stringify(checkedBoxesDate)); // deep copy
- chkBoxesCopy[position1][position2] = !chkBoxesCopy[position1][position2];
- setCheckedBoxesDate(chkBoxesCopy);
- }
- // 2. Nie działa ?
- const handleCheckBoxDate = (position1, position2) => {
- setCheckedBoxesDate((chkBoxes)=>{
- chkBoxes[position1][position2] = !chkBoxes[position1][position2];
- return chkBoxes;
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement