i declare a Array sate and want to add some Arrays in it like :
const [number, setNumber] = useState(3);
const [TimePickerList, setTimePickerList] = useState([]);
useEffect(() => {
for(var i = 0; i < number ; i++) {
setTimePickerList(TimePickerList.push([]))
}
console.log(TimePickerList); // it gives me an array like this : [[],[],[]]
}, [number])
but when i get log from TimePickerList in another function it gives me a number (3). and i lost my arrays in my array state (I expected something like this : [[],[],[]] But While gives me the length of the array) I also used concat() but it gives me an empty Array and doesn't add my Arrays
