The useScrollHeight hook takes a RefObject as an argument and returns the current scroll height of the referenced HTML element.
The motivation behind creating this custom hook is likely to provide a way to dynamically track the scroll height of an HTML element, which can be useful in various scenarios such as:
Updating the layout or styling of an element based on its scroll height
Monitoring the scroll height of a container element to trigger certain actions
The context in which this hook might be used is likely in a React application where the scroll height of an element needs to be tracked and updated in real-time (For example, in chats, where you will always need to show the last message)
Type of change
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change(fix or feature that would cause existing functionality to not work as before)
Description
The useScrollHeight hook takes a RefObject as an argument and returns the current scroll height of the referenced HTML element.
The motivation behind creating this custom hook is likely to provide a way to dynamically track the scroll height of an HTML element, which can be useful in various scenarios such as:
The context in which this hook might be used is likely in a React application where the scroll height of an element needs to be tracked and updated in real-time (For example, in chats, where you will always need to show the last message)
Type of change
Checklist
yarn test
)yarn lint
). Fix it withyarn lint:fix
in case of failure.yarn lint:types
).