import {ComponentChildren, h} from 'preact' import {useRef} from 'preact/hooks' import {Link} from './link' export function Container({ children, href, }: { children: ComponentChildren href: string }) { const ref = useRef(null) return (
{ if (ref.current) { // forwardRef requires preact/compat - let's keep it simple // to keep the bundle size down const anchor = ref.current.querySelector('a') if (anchor) { anchor.click() } } }}> {children}
) }