Skip to main content

Function: getSnapshot()

Call Signature​

function getSnapshot<T>(type, nodeOrPrimitive): TypeToSnapshotOut<T>;

Retrieves an immutable snapshot for a data structure. Since returned snapshots are immutable they will respect shallow equality, this is, if no changes are made then the snapshot will be kept the same.

Type Parameters​

Type ParameterDescription
T extends AnyTypeObject type.

Parameters​

ParameterTypeDescription
typeT-
nodeOrPrimitiveTypeToData<T>Data structure, including primtives.

Returns​

TypeToSnapshotOut<T>

The snapshot.

Call Signature​

function getSnapshot<T>(nodeOrPrimitive): SnapshotOutOf<T>;

Retrieves an immutable snapshot for a data structure. Since returned snapshots are immutable they will respect shallow equality, this is, if no changes are made then the snapshot will be kept the same.

Type Parameters​

Type ParameterDescription
TObject type.

Parameters​

ParameterTypeDescription
nodeOrPrimitiveTData structure, including primtives.

Returns​

SnapshotOutOf<T>

The snapshot.