I've created a React class with state variable as array type.
export default class Demo extends React.Component {
constructor(props){
super(props)
this.state ={
test: []
}
}
Now, when I use console.log(this.state.test) in render function then it returns object type. I thought it is for the unique-key purpose when mapping.
But, what if I just want to define an array for push method?
Is there any other way to define the same? Please guide.
testis not an array, it's just a key