I declared arr2d as state = { arr2d: [] }
. I want to access it in my render method given below.
I have defined it in componentDidMount()
.
my render method is as follows
render() {
return (
<div className="App">
<button
onClick={() => {
console.log(this.state.arr2d[0][1]);
}}
>
Click Me
</button>
{console.log(this.state.arr2d[0][1])}
</div>
);
}
This is my first time asking question on stackoverflow. I would really appreciate any help.Thank you.