Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

useStick

React hook to read the window height Position and change the state when it is in a defined height;

These hook is tinked to be used as a solution to stick header components, you can use it like this:

import {useStick} from 'useStick'

function MyComponent(){
  const [stick] = useStick(false, 900)
  
  return (
    <div className={`my-component ${stick && "stick-class"}`}>
    ...
    </div>
  )
}

When you scroll the window 900 pixels it will trigger the state change, and your stick-class will be added to the component div

About

React hook to read the window height Position and change the state when it is in a defined height

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages