0.11.4 • Published 4 months ago

nanostores v0.11.4

Weekly downloads
-
License
MIT
Repository
github
Last release
4 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-client@drupal-api-client/api-client@drupal-api-client/utils@drill4j/test2code-ui@ctx-core/nanostores@ctx-core/solid-nanostoresbetter-auth-uuidv4kasdaklsdajldjalkhan-uikhambakitchencraft@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@atrament/web@astro-auth/client@agent-smith/body@agent-smith/brain@agent-smith/jobs@aittorai/ui@aittorai/ui-library@better-auth/expo@buerto/demo-cc@clerk/astro@chamaeleon/devtools@actionbar/react@dfds-platform/trackinguse-cmsify@finsweet/fs-components@headstash/ui@fractl-ui/evm@fractl-ui/fuel@fractl-ui/starknet@flexy.tech/widget@gasbot/widget@kreatif/starter@kseniass/react-flow-editor@mysten/zksend@mysten/enoki@neocodemirror/svelte@nanopiniated/react@nanopiniated/vue@narration-sd/sanity-astro-presentation@nanotree/core@engagespot/core-v2@energize-group/ui@mixoo/stores@kbve/laser@invoke-ai/ui@invoke-ai/ui-library@kksh/vue@kb-sanity/proto-kb-plugin@omnisat/lasereyes-core@omnisat/lasereyes-react@sa-frontend/presentation@qix-js/core@recative/act-player@recative/ap-preview@recative/core-manager@rezolabs/astro-boilerplate@portal-sdk/client@pickguru/pages@pickguru/groups@pinelab/vendure-order-client@podium/store@patrickspafford/use-is-scrolling-down@patrickspafford/use-scroll-progress@photonhealth/sdk@phoenix-islands/core@phoenix-islands/proxy@novely/renderer-toolkit@pindoba/astro-dialog@pindoba/astro-loading@pindoba/astro-popover@page-blocks/client@page-blocks/react@page-blocks/react-client@page-blocks/react-editor
0.11.4

4 months ago

0.11.3

10 months ago

0.11.0

10 months ago

0.11.1

10 months ago

0.11.2

10 months ago

0.10.3

1 year ago

0.10.1

1 year ago

0.10.2

1 year ago

0.10.0

1 year 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

2 years ago

0.7.2

2 years ago

0.7.4

2 years ago

0.7.3

2 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

3 years ago

0.5.12

3 years ago

0.5.10

3 years ago

0.5.8

4 years ago

0.5.7

4 years ago

0.5.9

3 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