Advanced / Store Advanced

snapshot

Returns a plain (non-proxy, non-reactive) deep copy of a store value. Reading via snapshot does not subscribe to changes — use this when you need to hand a stable plain object to non-reactive code (logging, serialization, structured-clone, network payloads, etc.).

Returns the original object identity for any sub-tree that wasn't modified relative to the proxy's underlying source.


Import

import { snapshot } from "solid-js";

Type signature

function snapshot<T>(item: T): T;
function snapshot<T>(
item: T,
map?: Map<unknown, unknown>,
lookup?: WeakMap<any, any>
): T;

Examples

const [state] = createStore({ user: { name: "Ada" }, todos: [] });
console.log(JSON.stringify(snapshot(state))); // safe, non-reactive copy
Last updated: 7/4/26, 6:21 PMEdit this pageReport an issue with this page