# Nano Stores

> A tiny state manager for React, React Native, Preact, Vue, Svelte, Solid, Lit, Angular, and vanilla JS.

- URL: https://evilmartians.com/opensource/nano-stores
- GitHub: https://github.com/nanostores/nanostores
- Authors: Andrey Sitnik

---

Nano Stores is a tiny state manager for React, React Native, Preact, Vue, Svelte, Solid, Lit, Angular, and vanilla JS. It uses many atomic stores and direct manipulation.

* **Small**: Nano Stores is between 266 and 969 bytes (minified and gzipped). It has zero dependencies and uses [Size Limit](https://evilmartians.com/opensource/size-limit) to control its size.
* **Fast:** With small atomic and derived stores, you don't need to call the selector function for all components on every store change.
* **Tree Shakable:** A chunk only contains stores used by components in the chunk.
* Designed to move logic from components to stores.
* Good **TypeScript** support.

Nano Stores can be integrated with many frameworks. For instance, here is an [article about how to use Nano Stores in Angular](https://dev.to/evilmartians/nano-stores-in-angular-how-to-make-the-state-management-simpler-38a1) and its advantages.

```ts
// store/users.ts
import { atom } from 'nanostores'

export const users = atom([])

export function addUser(user: User) {
  users.set([...users.get(), user]);
}
```

```ts
// store/admins.ts
import { computed } from 'nanostores'
import { users } from './users.js'

export const admins = computed(users, list =>
  list.filter(user => user.isAdmin)
)
```

```tsx
// components/admins.tsx
import { useStore } from '@nanostores/react'
import { admins } from '../stores/admins.js'

export const Admins = () => {
  const list = useStore(admins)
  return (
    <ul>
      {list.map(user => )}
    </ul>
  )
}
```
