npm install use-viewport-height
// or
yarn add use-viewport-height
// 1. Import the hooks
import useViewportHeight from 'use-viewport-height'
const App = () => {
// 2. Add it to your app
useViewportHeight()
return (...)
}
and anywhere in your css file you can access the viewport height with: var(--tenka-viewport-height)
.my-div {
height: var(--tenka-viewport-height);
}