I am a beginner in React js and trying to do some operations.
I want to create an array till the length of any array (particular number) suppose my array length is 10 , then the array should be
my state variables-
this.state{
length = 10,
length_array= []
}
handleClick = () =>{
this.setState{
length_array:[1,2,3,4,5,6,7,8,9,10]
}}
I want to display this array in my table header
<Table>
<tr>
<th>
this.state.length_array.map((item, key) =>
<th>{item.name}</th>
);
</th>
</tr>
</Table>
Thanks.