ChemPal Documentation - v1.18.0
    Preparing search index...

    Function usePriceAlerts

    • The user's price alerts, kept up to date as any page or the background worker changes them.

      Returns PriceAlert[]

      The alerts, newest first; empty until they have loaded

      const alerts = usePriceAlerts();
      const isWatched = alerts.some(({ id }) => id === productSeriesKey(product));
      export function usePriceAlerts(): PriceAlert[] {
      const [alerts, setAlerts] = useState<PriceAlert[]>([]);

      useEffect(() => watchPriceAlerts(setAlerts).stop, []);

      return alerts;
      }