I have multiple state variable in my component. Is there a way to iterate through all the state variable using for loop to get their value?
class AreaCalculator extends React.Component{
constructor(props){
super(props);
this.state={Area1 : 'success',
Area2 : 'failure',
Area3 : 'success',
Area4 : 'failure',
Area5 : 'success',
Area6 : 'success',
Area7 : 'success',
Area8 : 'failure'
}
}
componentDidMount(){
//Adding a for loop to print the value of state variable
for(var i=0; i< this.state.length(); i++){
//console log state variable value
}
}