import { useS } from "use-s-react";
export default function Component() {
const [count, setCount] = useS(0); // like useState
return (
<button
onClick={() => setCount((prev) => prev + 1)}
>
You clicked {count} times
</button>
);
}
import { useS } from "use-s-react";
export default function Component() {
const [count, setCount] = useS({ value: 0, key: 'global-counter' });
return (
<button
onClick={() => setCount((prev) => prev + 1)}
>
You clicked {count} times
</button>
);
}
Powerful features that make state management intuitive and efficient
Share state across components via key, accessible anywhere
Works like useState by default when no key is provided
Fully typed with automatic type inference
Deep and optimized immutability using efficient cloning
No providers, context, or wrapper components needed
Less than 2KB min+gzip - performance first
Built-in computed values via functions, no external abstraction
Works in React Web and React Native applications
Fully compatible with concurrent rendering and modern React
Enables advanced patterns without breaking existing code
debugGlobalStore() for development insights
Built-in state persistence (coming soon)
Join developers who are building better React apps with useS