Best of React HooksJanuary 2025

  1. 1
    Article
    Avatar of tigerabrodiTiger's Place·1y

    useDebounceCallback hook explained

    This post explains how to create a custom useDebounceCallback hook in React, detailing the importance of closures and the callback reference pattern. Examples illustrate how closures capture variables from outer scopes, and how useRef helps in maintaining the latest callback function in React's functional components.

  2. 2
    Article
    Avatar of tigerabrodiTiger's Place·1y

    A quick overview of React 19 (my notes)

    React 19 introduces several enhancements for handling async operations, optimistic updates, better ref handling, simpler context usage, and managing document metadata within components. It includes the useTransition hook for smoother async operations, the useActionState hook for cleaner async actions, and the useOptimistic hook for instant UI updates that can revert if an API call fails. The use hook helps manage promises directly in the render phase, and context and ref handling have been simplified.