Appearance
useParentElement
Get parent element of the given element
Demo
Usage
tsx
import { useParentElement } from '@reause/core'
import { useRef } from 'react'
const childRef = useRef<HTMLDivElement>(null)
const parent = useParentElement(childRef) // HTMLElement | SVGElement | null | undefinedType Declarations
ts
type ElementSource = HTMLElement | SVGElement | null | undefined
export function useParentElement(element?: RefObject<ElementSource>): ElementSource