Compare NPM Packages

1 Year
nanostoresSimilar Packages:
NPM Package Downloads Trend
Stat Detail
Package
Weekly Downloads
Github Stars
Issues
Commit
License
nanostores46,8254,77523a day agoMIT License
Similar Npm Packages to nanostores

nanostores is a minimalistic state management library for React applications. It provides a simple and efficient way to manage state in your components without the need for complex setup or boilerplate code. While nanostores offers a lightweight state management solution, there are other libraries in the React ecosystem that provide similar functionality. Here are a few alternatives:

  • effector is a state management library that focuses on predictable state management and side effects. It offers a powerful way to manage state and handle complex data flows in React applications.
  • mobx is a popular state management library that enables reactive programming in JavaScript. It provides observables and reactions to automatically update components when the underlying data changes.
  • recoil is a state management library for React applications developed by Facebook. It offers several features such as atoms and selectors to manage global state in a more efficient way.
  • zustand is a minimalist state management library that focuses on simplicity and performance. It provides a clean API for managing state in React components with a small footprint.

Check out this comparison: Comparing effector vs mobx vs nanostores vs recoil vs zustand.

README for nanostores

Nano Stores

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. Between 286 and 818 bytes (minified and brotlied). Zero dependencies. It uses Size Limit to control size.
  • 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. A chunk contains only stores used by components in the chunk.
  • Designed to move logic from components to stores.
  • Good TypeScript support.
// store/users.ts
import { atom } from 'nanostores'

export const $users = atom<User[]>([])

export function addUser(user: User) {
  $users.set([...$users.get(), user]);
}
// store/admins.ts
import { computed } from 'nanostores'
import { $users } from './users.js'

export const $admins = computed($users, users => users.filter(i => i.isAdmin))
// components/admins.tsx
import { useStore } from '@nanostores/react'
import { $admins } from '../stores/admins.js'

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

  Made in Evil Martians, product consulting for developer tools.


Docs

Read full docs here.