Next.js for Drupal
DocsDemoGitHubDrupal
/
,

Hooks

Client API Reference for next-drupal


The following functions are meant to be called on the client.

useMenu

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")
Introduction

© 2021 Next.js for Drupal - Development sponsored by Chapter Three.

DocsDemoGitHubDrupal