I am building an app which fetches the following JSON response:
{
"result": [
{
"id": 6,
"name": "Test 1",
"parent": 5
},
{
"id": 17,
"name": "Test2",
"parent": 5
}
}
}
I would like to map through the result, and display in an unordered list.
App.js:
function App() {
const [items, setItems] = useState([]);
useEffect(() => {
const searchDB = () => {
fetch("http://127.0.0.1:8443/subColumns/5/?key=fc257229-8f91-4920-b71f-885403114b35", {
mode: 'cors',
credentials: 'include'
})
.then(res => res.json())
.then(
(json) => {
setIsLoaded(true);
setItems(json);
},
(error) => {
setIsLoaded(true);
setError(error);
}
)
}
searchDB();
}, [])
useEffect(() => {
console.log(items.result);
}, [items]);
return (
<ul>
{(Object.entries(items)).map(item => (
<li key={items.id}>
{item.id} - {item.name} - {item.parent}
</li>
))}
</ul>
);
}
However, the current output shows the map is only running once and displays is as follows:

items.results.map(item => (...))inside return ?