Skip to content
On this page

React 19

A render is a draft. React may pause it, run it again, or throw it away. Better Hooks waits for commit before treating values and browser work as real.

Render is a draft

useLatest and usePrevious publish from effects, so they expose committed values rather than data from a render React abandoned. That distinction matters when a timer, listener, or promise callback outlives the render that created it.

Actions stay stable, callbacks stay fresh

When an action is documented as stable, its function identity does not change just because the component rendered again. Long-lived work can keep the action while still calling the latest committed callback, avoiding both stale closures and needless resubscriptions.

Cleanup is part of the feature

Strict Mode may replay effects in development. Setup and cleanup therefore come as a pair: listeners are removed, timers are cancelled, observers disconnect, and pending work stops being current. A replay should leave the same native work behind as a normal mount.

Errors do not disappear

An onError callback can observe a failure, but it does not turn the failure into success. The original throw or rejected promise still belongs to the application. Work that has been cancelled or superseded is ignored only when the Hook documents that behavior.

Use React when React already fits

Keep using useTransition, useDeferredValue, useOptimistic, useActionState, and use directly. Better Hooks fills lifecycle gaps around React; it does not wrap built-in APIs just to give them another name.

Supported version

The current peer dependency is react >=19.0.0 <20.0.0. A wider range is documented only after the package and its tests are updated.