SolidJSS
SolidJS2y ago
58 replies
deminearchiver

Ref's parentElement

Is it safe to do this? How do I make the parent reactive?
export const Child: Component = (props) => {
  let ref!: HTMLElement;

  onMount(() => {
    ref.parentElement.addEventListener(/*... */);
  });

  return (
    <div ref={ref} />
  );
}
Was this page helpful?