Reputation: 181
My menu consists of sub menu, that's why my JSON is composed like this:
"Accueil" -> "Espace documentaire"
"Déploiement" -> "Indicateurs de déploiement", "Fichiers NetGeo", "Fichiers STBAN" ...
So I want to make a menu with a Treeview that initially displays the map "Accueil" then the (children) "Espace documentaire"
Here is the JSON object:
Here is the function:
getMenuItems().then(response => {
const item = response.data;
return(
<div>
{ console.log(item) }
{ item.map(menu => {
return (
// ...
);
})};
</div>
);
});
Upvotes: 0
Views: 706
Reputation: 2730
Paul, I've made a simple showcase for you: https://m1go3.csb.app/.
There is a recursive function component to render nested children
items.
Here is the link to the source: https://codesandbox.io/s/ecstatic-hofstadter-m1go3
Upvotes: 2