react hooks

2024-11-02 JS

useRef

Sometimes I saw 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 difference is that changing the value of a ref don't trigger a re-rendering.

custom hooks

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

state and context

❰ back