Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nanostores/solid
Global state management in Solid using nanostores.
https://github.com/nanostores/solid
nanostores solid state-management
Last synced: 6 days ago
JSON representation
Global state management in Solid using nanostores.
- Host: GitHub
- URL: https://github.com/nanostores/solid
- Owner: nanostores
- License: mit
- Created: 2021-08-13T13:54:03.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-09-27T17:35:05.000Z (about 1 month ago)
- Last Synced: 2024-10-12T02:54:49.825Z (27 days ago)
- Topics: nanostores, solid, state-management
- Language: TypeScript
- Homepage:
- Size: 618 KB
- Stars: 73
- Watchers: 2
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-solid-js - Solid Nanostores
README
# Nano Store Solid
Solid integration for **[Nano Stores]**, a tiny state manager
with many atomic tree-shakable stores.* **Small.** Less than 1 KB. Zero dependencies.
* **Fast.** With small atomic and derived stores, you do not need to call
the selector function for all components on every store change.
* **Tree Shakable.** The chunk contains only stores used by components
in the chunk.
* Was designed to move logic from components to stores.
* It has good **TypeScript** support.[Nano Stores]: https://github.com/nanostores/nanostores/
## Installation
```bash
npm install nanostores @nanostores/solid
```## Usage:
```ts
// store.ts
import { atom } from 'nanostores';export const $counter = atom(0);
export const increase = () => {
$counter.set($counter.get() + 1);
}
``````tsx
import { useStore } from '@nanostores/solid';
import { $counter, increase } from './store';function Counter() {
const count = useStore($counter);
return{count()} around here ...
;
}function Controls() {
return one up;
}
```## License
MIT