use-nestable-dropdown.tsx 381 B

123456789101112
  1. import { NestableDropdownContext } from '@/shared/context/nestable-dropdown-context'
  2. import { useContext } from 'react'
  3. export const useNestableDropdown = () => {
  4. const context = useContext(NestableDropdownContext)
  5. if (context === undefined) {
  6. throw new Error(
  7. 'useNestableDropdown must be used within a NestableDropdownContextProvider'
  8. )
  9. }
  10. return context
  11. }