Docs

Frequently Asked Questions

Common questions and patterns for using SuperState.

How does SuperState compare to React Context?

React Context is built for dependency injection and small, infrequent changes. SuperState is optimized for high-frequency global state updates using useSyncExternalStore, which avoids unnecessary re-renders of the component tree.

Is SuperState safe for production?

Yes. SuperState is used in production environments and is built on React 18's native synchronization API. It has a minimal memory footprint and zero external dependencies.

How do I handle SSR/Next.js hydration?

SuperState works out of the box with SSR. Ensure your initial state values are consistent between client and server. For advanced use cases, we provide a SuperStateProvider for dehydrating/rehydrating state.

Does it support nested objects?

Yes, SuperState supports dot-notation (e.g., 'user.address.city') for both reading and updating nested state. This ensures your components only re-render when the specific property they watch changes.

Have more questions?
Join our GitHub Discussions or open an issue on the repository. We're happy to help!