Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nanostores/solid

Global state management in Solid using nanostores.
https://github.com/nanostores/solid

nanostores solid state-management

Last synced: 3 days ago
JSON representation

Global state management in Solid using nanostores.

Awesome Lists containing this project

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