@pond-ts/react API Reference
    Preparing search index...

    Function useDerived

    • Apply a batch transform to a TimeSeries snapshot, recomputing only when the input snapshot changes.

      The transform function should be referentially stable (wrap in useCallback if it captures changing dependencies). Returns null when the input snapshot is null.

      Type Parameters

      • S extends SeriesSchema
      • R

      Parameters

      • series: TimeSeries<S> | null
      • transform: (series: TimeSeries<S>) => R

      Returns R | null

      const [, snapshot] = useLiveSeries(opts);
      const smoothed = useDerived(snapshot, (s) =>
      s.smooth('cpu', 'ema', { alpha: 0.2 }),
      );