'How to populate array of arrays in react state variable?

I'm trying to add an array to an array of arrays every function run. How can I append the array to my array of arrays state variable?

Here is my code:

const [volChart, setVolChart] = useState([])

function makeQueryHistorical(contract) {
   setVolChart([...volChart, days])
}

list.forEach((token) => {
   makeQueryhistorical(token.address)
})

Right now it only replaces the current value instead of adding a new array



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source