Sometimes is see that someone use useRef in situations i would use 'useState'.
const blocking = React.useRef(false);
const onScroll = () => {
if (!blocking.current) {
blocking.current = true;
...
}
};
One of the main diffrence is that changing the value of a ref don't trigger a re-rendering.
Robin Wieruch write create articels to create and usage of custom hooks.