Skip to content

Instantly share code, notes, and snippets.

@biancadragomir
Last active October 15, 2021 15:59
Show Gist options
  • Save biancadragomir/246b204494f3f127c3090f0175c594fc to your computer and use it in GitHub Desktop.
Save biancadragomir/246b204494f3f127c3090f0175c594fc to your computer and use it in GitHub Desktop.
...
type Props = {
const isPopupOpen: boolean;
const closePopup: () => void;
}
const Popup = (props: Props) => {
...
const handleScroll = useCallback(() => {
if (props.isPopupOpen) {
props.closePopup();
}
}, [props.isPopupOpen]);
useOnScrollEffect(handleScroll, INFINITE_SCROLL_ID);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment