I have a array and each element in the Array can be an array of cars ICar[], I am having issues adding an item to the list
const [carList, setCarList] = React.useState<[ICar[]]>([[]]);
When it comes to setting the state normally if it was a array of objects I would do the following
setCarList(initialList => [...initialList, JSON.parse(JSON.stringify(car))]); // this works when its just an array of ICar
But when I make it [ICar[]]
I have issues
const cars = [JSON.parse(JSON.stringify(car))] as ICar[];
setCarList(initialList => [[...initialList],cars]);