react

  • Event delegation moved to the root in 17

    React 16 attached every handler to document and 17 attaches them to the root container, which changes what stopPropagation can prevent. The change exists to make two React…

  • The new JSX transform, and the React import you can delete

    JSX compiled to React.createElement required React to be in scope; the new transform imports what it needs itself. The output is marginally smaller and the ceremony disappears, and…

  • A key that is an array index breaks reordering

    A key tells React which element is which between renders, and an index says only “the third one”, which is a different element after a sort. The bug…

  • useRef for a value that must not trigger a render

    A ref is a mutable box that survives renders and does not participate in them, which is the right shape for a timer id, a previous value or…

  • useEffect with an empty array is not componentDidMount

    An effect with an empty dependency array runs once after the first render, which resembles a mount hook and differs in when it fires and what it can…

  • Vite in development and webpack in production is a real answer

    A 38-second dev server start on a machine with nothing else to do. Native ESM changes the feedback loop, and running two build tools has a specific cost.

  • AbortController, and the fetch that outlived the component

    A fetch started in an effect keeps running after unmount, and its then sets state on a component that no longer exists. The abort rejects the promise with…

  • useMemo is a hint and not a guarantee

    React may discard memoised values to free memory, so useMemo is a performance optimisation and never a correctness mechanism. The documentation is explicit that a future version may…

  • The cleanup function runs before the next effect too

    Cleanup is not only an unmount hook — it runs before every re-run of the effect, which is what makes a subscription with changing dependencies correct. The ordering…

  • React 17 is a release with no features

    A major version whose entire purpose is to let two versions run on one page. And an event delegation change that breaks anything mixing React with jQuery.