enter image description hereNeed to create a same new table with headings as shown above , when show button is clicked.it should create a table without the data but with the same headings The table should create each time when the show button is clicked .
Asked
Active
Viewed 1,156 times
0
-
Can you please share what you've tried so far – Azarro May 09 '22 at 05:39
-
@Azarro do check the question now – Murshidha Musthafa May 09 '22 at 14:10
1 Answers
1
const[table,setTable] = useState([ <table>
<tr>
<th>Heading 1</th>
<th>Heading 2</th>
<th>Heading 3</th>
</tr>
</table>])
const crteateNewTable = ()=>{
setTable([...table,<table>
<tr>
<th>Heading 11</th>
<th>Heading 22</th>
<th>Heading 33</th>
</tr>
</table>])
}
return (
<div className="App">
{table}
<button onClick={crteateNewTable} style={{marginTop:"20px"}}> Create Table </button>
</div>
hope this will help you with what you looking for

vibhu
- 369
- 3
- 10