0.11.4 • Published 8 months ago

nanostores v0.11.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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 265 and 803 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 at Evil Martians, product consulting for developer tools.


Docs

Read full docs here.

blakprint-utils-ts@infinitebrahmanuniverse/nolb-nan@everything-registry/sub-chunk-2245nano-query-2@akinon/ui-docssvelte-pianowebcomponent-constructorwhat-is-word-clisvag-storikvendure-order-clientbetter-auth-uuidv4kasdaklsdajldjalkhan-uikhambakitchencrafthyvor-talk-comments@webstudio-is/sdk-components-animation@woat/enoki@web-media/act-player@web-media/ap-preview@web-media/core-manager@webhelpers/formula@tutorialkit/runtime@tutorialkit/astro@tutorialkit/components-react@tutorialkit/react@unitythemaker/better-auth@vaadin/dspublisher@xsolla/babka-overlay-sdk@xsolla/metaframe-react-sdk@xton/enoki@y_nk/astro-carousel@zainer/better-authauf-nextaw-payment-widgetastromixappwrite-utils-cliaptimusaptimus-movementaptimus-sdk-testassumendarerum@iosifnicolae22/better-auth@atrament/web@atomrigslab/better-auth@grng/silica@graphql-detective/core@clerk/astro@actionbar/react@agent-smith/jobs@agent-smith/body@agent-smith/brain@aittorai/ui@aittorai/ui-library@codacus/bolt.diy@comenchi/admin-sdk@allenthich/better-feature@allenthich/better-feature-example-plugin@allenthich/react-library-template@silveltman/fulluidappsim-vc-wallet@xsolla/metaframe-testlasereyes-corelasereyes-reactlasereyes-vuesuperdoughsolid-nanostorestypes-drp-uikitusepwastateusepythonusepython-dev@astrodown/mars-core@astro-sitecore-jss/astro-sitecore-jss@astro-tabs/preact@astroshuttle/auth-client@astro-auth/client@better-auth/expo@buerto/demo-cc@chamaeleon/devtoolsuse-cmsify@kreatif/starter@kseniass/react-flow-editor@mysten/zksend@mysten/enoki@neocodemirror/svelte@nanopiniated/react@nanopiniated/vue@narration-sd/sanity-astro-presentation@nanotree/core@mixoo/stores@kbve/laser@kksh/vue@kb-sanity/proto-kb-plugin@sa-frontend/presentation@qix-js/core@recative/act-player@recative/ap-preview@recative/core-manager@rezolabs/astro-boilerplate@portal-sdk/client@pickguru/pages
0.11.4

8 months ago

0.11.3

1 year ago

0.11.0

1 year ago

0.11.1

1 year ago

0.11.2

1 year ago

0.10.3

2 years ago

0.10.1

2 years ago

0.10.2

2 years ago

0.10.0

2 years ago

0.9.4

2 years ago

0.9.5

2 years ago

0.9.3

2 years ago

0.9.0

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.8.1

2 years ago

0.8.0

3 years ago

0.7.2

3 years ago

0.7.4

3 years ago

0.7.3

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.5.13

3 years ago

0.6.0

3 years ago

0.5.11

4 years ago

0.5.12

4 years ago

0.5.10

4 years ago

0.5.8

4 years ago

0.5.7

4 years ago

0.5.9

4 years ago

0.5.4

4 years ago

0.5.6

4 years ago

0.5.5

4 years ago

0.5.3

4 years ago

0.5.0

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.4.9

4 years ago

0.4.8

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago