fix: ref usage in useIntersectionObserver and update Navbar
This commit is contained in:
parent
bec725da38
commit
21d5b440d4
2 changed files with 14 additions and 16 deletions
|
|
@ -17,13 +17,15 @@ export function useIntersectionObserver() {
|
|||
}
|
||||
);
|
||||
|
||||
if (ref.current) {
|
||||
observer.observe(ref.current);
|
||||
const currentRef = ref.current; // Store the ref value in a variable
|
||||
|
||||
if (currentRef) {
|
||||
observer.observe(currentRef);
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (ref.current) {
|
||||
observer.unobserve(ref.current);
|
||||
if (currentRef) {
|
||||
observer.unobserve(currentRef);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue