useTrackedEffect

A React Hook for detecting dependencies that have actually changed between renders.

Demo

Try to open DevTools to see the logs.

Source
{
  "name": "John Doe",
  "age": 30
}

count: 0
Name:
Count:
0

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

useTrackedEffect(callback, deps)

Callback

export type TrackedEffectCallback = (changedDepIndexes: number[], previousDeps?: Deps, currentDeps?: Deps) => void

Deps

Same as React.useLayoutEffect.