Skip to content

A React hook for managing URL hash-based navigation with section-specific callbacks.

License

Notifications You must be signed in to change notification settings

asingh1098/useHashNavigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

useHashNavigation

A React hook for managing URL hash-based navigation with section-specific callbacks.

Usage

import useHashNavigation from "use-hash-navigation";

const MyComponent = () => {
    const {showText, setShowText} = useState<boolean>(false);
    const { navigateToSection, clearSection } = useHashNavigation(setShowText);

    return (
            <div>
                {!showText && <button onClick={() => navigateToSection('foobar')}>Navigate foobar Section</button>}
                {showText && Welcome to Section}
                {showText && <button onClick={clearSection}>Go back</button>}
            </div>
    );
};

About

A React hook for managing URL hash-based navigation with section-specific callbacks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published