Inserting Arrays into JSX
You can insert arrays. See example:
function App() {
const arr = [1, 2, 3];
return <div>
<p>{arr[0]}</p>
<p>{arr[1]}</p>
<p>{arr[2]}</p>
</div>;
}
Given an array:
function App() {
const arr = [1, 2, 3, 4, 5];
}
Make the rendering result be a ul
tag, with the array elements in the li
tags.