description |
---|
Retrieve a node higher than the current webcomponent. |
import { useParent, useParentPath } from "@atomico/hooks/use-parent";
const selector = "form";
const parent = useParent(selector);
Where:
selector
:String
, Selector to be used by Element.matches when searching for the parent.parent
:Element
, ascending search result according to selector.
const parents = useParentPath(composed?: boolean);
Where:
parents:
parent nodes of the webcomponentcomposed
: bypasses shadow DOM in parent capture.
{% embed url="https://webcomponents.dev/edit/collection/n2tZyzx4LMKqk1jNE0e9/OVpU1DQvmGjhYSf3Iqbu/src/index.jsx" %}