Manage deeply nested reactivity with Solid Store
mainSolid Store provides primitives for handling deeply nested reactive structures using Proxies. It allows you to create complex state objects where updates to nested properties trigger fine-grained reactivity.
Core Primitives
createStore: The primary way to create a reactive, nested state object.createMutable: An alternative primitive for creating dynamic nested reactive structures.
Helper Methods
To augment the behavior of the store setter, you can use:
produce: Allows for localized mutation (writing code that looks like direct mutation) within a setter.reconcile: Used for data diffing to update a store to match a new object while preserving reactivity.
For detailed API documentation, visit the official SolidJS website.
import { createStore } from "solid-js/store";
const [store, setStore] = createStore({
user: {
firstName: "John",
lastName: "Smith"
}
});
// update store.user.firstName
setStore("user", "firstName", "Will");