matchByDataKey
Create a matching function that pairs items by a data key from their payload. Useful for time-series or streaming charts where new data points are added to one end and old points are removed from the other. This ensures existing points animate smoothly to their new positions instead of shifting by index. Available since Recharts 3.9
Return value
AnimationMatchBy<{ payload?: unknown; }>
An AnimationMatchBy function that can be passed to the animationMatchBy prop
Props
dataKeyFunction | number | string
The key to look up in each item's payload (e.g., 'timestamp', 'date', 'id')