Open purskills opened 4 years ago
I’m not sure what you mean - there’s no events in server side rendering to fire.
Same, Also it logs 8 clicks outside for every 1 click
There are no clicks in serverside rendering. Perhaps you're seeing this in the browser?
You're welcome :-)
import BaseOutsideClickHandler from 'react-outside-click-handler'
export function OutsideClickHandler({
children,
onOutsideClick,
}: {
children: React.ReactNode
onOutsideClick: () => void
}) {
if (typeof document === 'undefined') {
return children
}
return (
<BaseOutsideClickHandler onOutsideClick={onOutsideClick}>
{children}
</BaseOutsideClickHandler>
)
}
always firing outside click event on server-side rendering.
to reproduce, use the sample code.