use-scroll-position
use-scroll-position copied to clipboard
Fixes #41
trafficstars
Fixes #41
Argument of type 'MutableRefObject<HTMLElement | null>' is not assignable to parameter of type 'MutableRefObject<HTMLElement | undefined>'.
Type 'HTMLElement | null' is not assignable to type 'HTMLElement | undefined'.
Type 'null' is not assignable to type 'HTMLElement | undefined'.ts(2345)
Do you also need to modify line 40 to something like:
const containerPosition = getClientRect(boundingElement?.current === null ? undefined : boundingElement?.current);
Might be a more elegant way to do it, but that solved it for me.