I'm trying to figure out a way to add objects into my array. Here's the code.
export default function DashboardTable(props) {
const { transactionData } = props;
const classes = useStyles();
const [transactionDataArray, setTransactionDataArray] = useState([])
useEffect(() => {
setTransactionDataArray(transactionDataArray.push(transactionData))
}, [transactionData])
console.log(transactionDataArray);
transactionData returns objects (the amount of objects is variable depending on the back end transactions.) I want to add the objects to the array transactionDataArray
but I keep getting the error transactionDataArray is not a function
. Where am I going wrong?