• useScrollToggle is a custom React hook that provides a handle to control the scroll position of the window. The handle has three methods: enable, disable, and toggle.

    Returns AttachedScrollHandle

    The handle with the following methods:

    • enable: This method enables the scroll and restores the scroll position to the last known position.

    • disable: This method disables the scroll and stores the current scroll position.

    • toggle: This method toggles between enabling and disabling the scroll.

    Example

    const scrollHandle = useScrollToggle();
    scrollHandle.disable(); // Disables the scroll
    scrollHandle.enable(); // Enables the scroll
    scrollHandle.toggle(); // Toggles the scroll state