Use the useLayoutEffect() with an empty array as the second argument to execute the provided callback only once when the component is mounted. Use Window.getComputedStyle() to get the overflow value of the body element and store it in a variable. Enables body scroll locking.

1m read timeFrom 30secondsofcode.org
Post cover image
2 Comments

Sort: