react hooks

2024-11-02 JS

useRef

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.

custom hooks

Robin Wieruch write create articels to create and usage of custom hooks.

state and context

❰ back