Here is my simple react component.
export default function App() {
const [stats, setStats] = React.useState(() => {
return {
name: "",
lvl: 1
}})
let displayStats;
for(let key in stats) {
displayStats += <p>{key}</p>
}
return (
<>
{displayStats}
</>
)
}
This displayStats variable returns 'undefined[object Object][object Object]' on the screen. Why? What am I doing wrong.