TinyBase logoTinyBase

Metrics hooks

This is the collection of metrics hooks within the ui-react module. There are 7 metrics hooks in total.

useCreateMetrics

The useCreateMetrics hook is used to create a Metrics object within a React application with convenient memoization.

useMetric

The useMetric hook gets the current value of a Metric, and registers a listener so that any changes to that result will cause a re-render.

useMetricIds

The useMetricIds hook gets an array of the Metric Ids registered with a Metrics object, and registers a listener so that any changes to that result will cause a re-render.

useMetricListener

The useMetricListener hook registers a listener function with the Metrics object that will be called whenever the value of a specified Metric changes.

useMetrics

The useMetrics hook is used to get a reference to a Metrics object from within a Provider component context.

useMetricsIds

The useMetricsIds hook is used to retrieve the Ids of all the named Metrics objects present in the current Provider component context.

useMetricsOrMetricsById

The useMetricsOrMetricsById hook is used to get a reference to a Metrics object from within a Provider component context, or have it passed directly to this hook.