Skip to main content

Function: onSnapshot()

function onSnapshot<T>(nodeOrFn, listener): OnSnapshotDisposer;

Adds a reaction that will trigger every time an snapshot changes.

Type Parameters​

Type ParameterDescription
T extends objectObject type.

Parameters​

ParameterTypeDescription
nodeOrFnT | (() => T)Object to get the snapshot from or a function to get it.
listenerOnSnapshotListener<T>Function that will be triggered when the snapshot changes.

Returns​

OnSnapshotDisposer

A disposer.