---
title: "Discussion on \"React useScrollLock Hook: Lock Body Scroll for Modals (2026)\" | Hashnode"
description: "Discussion on \"React useScrollLock Hook: Lock Body Scroll for Modals (2026)\". Your modal is open, centered, perfect. Then someone flicks the overlay and the page behind it scrolls away underneath. Everyone's first fix is the same three lines:\nuseEffect(() => {\n  document.body.s"
url: "https://hashnode.com/posts/react-usescrolllock-hook/6a856aa23692a8cf6db9ad75"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [React useScrollLock Hook: Lock Body Scroll for Modals (2026)](https://reactuse.hashnode.dev/react-usescrolllock-hook?utm_source=hashnode&utm_medium=feed)

Your modal is open, centered, perfect. Then someone flicks the overlay and the page behind it scrolls away underneath. Everyone's first fix is the same three lines: useEffect(() => { document.body.s

Aug 19 · 13 min read · reactuse.hashnode.dev  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[ReactUse](https://hashnode.com/@reactuse)

@reactuse

  
[View profile](https://hashnode.com/@reactuse)

Collection of 110+ essential React Hooks. Tree-shakable, SSR-safe, TypeScript-first.

Maintainer of @reactuses/core — 110+ essential React Hooks: SSR-safe, TypeScript-first, tree-shakeable. Docs &amp; interactive demos: https://reactuse.com · MIT-licensed and maintained in spare time — sponsorships keep it going: https://github.com/sponsors/childrentime

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
