I'm new to react js and i am stuck with this.Please send help..
const rows = results.map((data, i) => {
const district=data.districtData;
const state=data.state;
return (
<tr
key={i}
data-toggle="collapse"
data-target={`#${data.state}`}
aria-expanded="false"
aria-controls="navbarSupportedContent"
aria-label="Toggle navigation"
>
<td>{data.state}</td>
<td>{data.confirmed}</td>
<td>{data.active}</td>
<td>{data.recovered}</td>
<td>{data.deaths}</td>
</tr>
district.map((data, i) => {
return (
<tr className=" collapse" id={state} key={data.id}>
<td>{data.id}</td>
<td>{data.active}</td>
<td>Thornton</td>
<td>@fat</td>
<td>fad</td>
</tr>
);
});
);
});
This is my code snippet .I am using [https://api.covidindiatracker.com/state_data.json][1] API for my project I need a table that displays the state details and when the row is clicked the district details should be displayed.I tried to used bootstrap collapse for this..
const [results, setResults] = useState([]);
useEffect(() => {
axios
.get("https://api.covidindiatracker.com/state_data.json")
.then((res) => {
setResults(res.data);
})
.catch((err) => {
console.log(err);
});
}, []);
The data from the API is stored in results using the hooks. There is some error in the rows function(syntactical error i guess) Please help me find it and suggest corrections! [1]: https://api.covidindiatracker.com/state_data.json

setResults(res.data);tosetResults(res);