Skip to content

Instantly share code, notes, and snippets.

@TrekSoft
Last active February 8, 2022 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TrekSoft/6e5b1edadae3999770f62cf231d58547 to your computer and use it in GitHub Desktop.
Save TrekSoft/6e5b1edadae3999770f62cf231d58547 to your computer and use it in GitHub Desktop.
shouldFloatFooter function - windowHeight
const [windowHeight, setWindowHeight] = React.useState(window.innerHeight);
useEffect(() => {
function handleResize() {
setWindowHeight(window.innerHeight);
}
window.addEventListener('resize', handleResize);
return () => {
window.removeEventListener('resize', handleResize);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment