Hooks
Client API Reference for next-drupal
The following functions are meant to be called on the client.
useMenu
⚠️
You need to install the JSON:API Menu Items module to use `useMenu` and `getMenu`.
Returns menu items for a menu by name.
function useMenu(name: string): { items: DrupalMenuLinkContent[] tree: DrupalMenuLinkContent[] error: unknown isLoading: boolean}`items`is an array of menu items sorted by weight.`tree`is the hierarchical menu tree with parent and children.
Examples
const { tree, items } = useMenu("main")