
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
react-div-100vh
Advanced tools
Div100vh React component and use100vh React hookThis is a workaround for iOS Safari and other mobile browsers.
In mobile browsers, the real height of the viewport is dynamic, as browser
"chrome" (panels) slide away on scrolling. The browser developers faced two
choices: either to reflow the page as the pixel value of a vh changes, or
ignore the fact that the browser panel covers part of the screen.
The browser panels are supposed to slide away smoothly, and because the layout reflow during scrolling will not look smooth, the browser developers went for the second option.
It may work for the most of use cases, but if you're looking for an app-like
full-screen experience, or want to make sure that the call to action button at
the bottom of your splash screen isn't covered, you may need to know the fair
value of a vh.
<div style={{height: '100vh'}}> | <Div100vh> |
|---|---|
![]() | ![]() |
More on this issue here.
Div100vh React component is the default export:
import Div100vh from 'react-div-100vh'
const MyFullHeightComponent = () => (
<Div100vh>
<marquee>Look ma, no crop!</marquee>
</Div100vh>
)
For more advanced use cases (for instance, if you need 50% of the real height),
there is a named export use100vh. This React hook provides an accurate
vertical height in pixels. The return type is a number in a browser and null
in Node environment. You may need to check if it's not null if you're doing
SSR, otherwise, manipulate the value as you wish and concatenate the result with
px:
import { use100vh } from 'react-div-100vh'
const MyHalfHeightExampleComponent = ({ children }) => {
const height = use100vh()
const halfHeight = height ? height / 2 : '50vh'
return <div style={{ height: halfHeight }}>{children}</div>
}
Under the hood use100vh uses measureHeight function which is exported as
well, so feel free to use it, even without React. Currently it returns
document.documentElement?.clientHeight || window.innerHeight if executed in a
browser or null if on a server.
FAQs
A workaround for the '100vh' issue in mobile browsers
The npm package react-div-100vh receives a total of 50,929 weekly downloads. As such, react-div-100vh popularity was classified as popular.
We found that react-div-100vh demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.