react

  • Testing through the DOM rather than the component instance

    A test that reaches into component state asserts on the implementation, and every refactor that changed nothing observable breaks it. Querying by role rather than by test id…

  • Vue 3 and the Composition API

    A 600-line component with a mixin nobody could trace. The Composition API is not a new way to write components — it is a way to move logic…

  • Effect cleanup runs asynchronously in 17

    The one behavioural change in a release that deliberately has no features: cleanup functions now run after the screen has been updated rather than before. The reason is…

  • A stale closure in an effect, and the two ways out

    An effect with an empty dependency array captures the first render’s variables permanently, so a timer set up once reads values that stopped being current seconds later. A…

  • The new JSX transform, and the React import that goes away

    Every file using JSX had to import React even when it never referenced it, because JSX compiled to React.createElement. The compiled output imports react/jsx-runtime instead, which is a…

  • useMemo is a hint, not a guarantee

    The documentation says React may discard memoised values to free memory, and code that treats useMemo as a cache with a guarantee is relying on something that is…

  • Event delegation moved off document, and what that breaks

    React attached all its listeners to document, which is why two React versions on one page could not coexist and why mixing React with anything else was fragile.…

  • The dependency array is not a list of things to watch

    It reads like a watch list and it is not. It is a declaration of everything the effect closes over, and the effect re-runs whenever any of them…

  • TypeScript on a JavaScript codebase, one file at a time

    3.7 shipped optional chaining in November and the objection got smaller. allowJs, checkJs and a per-file opt-in — and strictNullChecks, which is the flag that pays.

  • useEffect returns a cleanup function, and you need it

    Anything an effect starts — a subscription, a timer, a fetch, an event listener — outlives the component unless the effect returns something that stops it. The cleanup…