Answer the question
In order to leave comments, you need to log in
How to make a fixed header when scrolling in React?
Hello, please tell me how to make an animated appearance of a fixed header in react when scrolling, I will be grateful for your help
. Will this approach be used correctly?
React.useEffect(() => {
window.addEventListener('scroll', function () {
if (window.pageYOffset > 0) {
console.log('open')
} else {
console.log('hide')
}
})
}, [])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question