I have this objects inside objects that I wanted to iterate in react
const [PersonInfo, setPersonInfo] = useState({
{name: "Juan", address: "Street1"},
{name: "Kristine", address: "Street2"}
}
I tried to render it in react using
return (
<div>
{{Object.keys(PersonInfo).map(key =>
<option value={key}>{PersonInfo[key]}</option>
)}
</div>
)
But it only shows the first value which is Juan. What is wrong with my code?
useStateis not valid, and the code will not run. Please show some working sample.