I have an array in the state and I want to render this array one by one with for loop. I can't figure out how to get the length of array, any idea? Thank you for the help. here is my code:
this.state = {
array: []
}
// here is the function to write data into array
render(){
return(
<div>
for(let i = 0; i < this.state.array.length; i++) { //this line doesn't work, error with length part
<p> {this.state.array[i]}</p> // this line will work if I wirte outside of loop
}
</div>
)
}