0.10.3 • Published 1 month ago

nanostores v0.10.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month 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 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.

blakprint-utils-ts@infinitebrahmanuniverse/nolb-nan@everything-registry/sub-chunk-2245nano-query-2@akinon/ui-docswebcomponent-constructor@mysten/enoki@mysten/zksend@nanotree/core@nanopiniated/react@nanopiniated/vue@narration-sd/sanity-astro-presentation@neocodemirror/svelte@page-blocks/client@page-blocks/react@page-blocks/react-client@page-blocks/react-editor@novely/renderer-toolkit@silveltman/fulluidappsim-vc-walletsvelte-pianosuperdoughsolid-nanostoressimpler-cookie-consentsimple-room-clientslick-modalsnap-querytypes-drp-uikitvendure-order-clientusepwastateusepythonusepython-devtubes_corewhat-is-word-cli@rileycki3333/component-box@rileycki3333/peeker@pickguru/pages@pickguru/groups@patrickspafford/use-is-scrolling-down@patrickspafford/use-scroll-progress@pinelab/vendure-order-client@photonhealth/sdk@mixoo/stores@standardnotes/stylekit@standardnotes/toastfracpaneframecast@recative/act-player@recative/ap-preview@recative/core-managerfullcart@phoenix-islands/core@phoenix-islands/proxy@web-media/act-player@web-media/ap-preview@web-media/core-manager@xsolla/metaframe-react-sdk@xsolla/metaframe-test@xsolla/babka-overlay-sdk@xton/enoki@sumup/circuit-ui@strudel/codemirror@webhelpers/formulagrading-pyramid@atrament/webassumendarerumastromixappwrite-utils-cli@astroshuttle/auth-client@astrodown/mars-core@astro-sitecore-jss/astro-sitecore-jss@astro-tabs/preact@astro-auth/clientaw-payment-widgetastro-clerk-auth@chamaeleon/devtoolshyvor-talk-comments@agent-smith/body@agent-smith/brain@agent-smith/jobs@actionbar/reactkhan-uibelive-embed-js@ctx-core/solid-nanostoreslikec4@dfds-platform/tracking@drupal-api-client/utils@drill4j/test2code-uidocugennpm-check-extras@energize-group/ui@engagespot/core-v2myfacade@y_nk/astro-carouselcomponents-thinhcomponents-thinh-testnanopiniatednanostores-persistent-solidcomponentslibarydbdtest@ctx-core/nanostores
0.10.3

1 month ago

0.10.1

1 month ago

0.10.2

1 month ago

0.10.0

3 months ago

0.9.4

7 months ago

0.9.5

6 months ago

0.9.3

10 months ago

0.9.0

12 months ago

0.9.2

11 months ago

0.9.1

12 months ago

0.8.1

1 year ago

0.8.0

1 year ago

0.7.2

1 year ago

0.7.4

1 year ago

0.7.3

1 year ago

0.7.1

1 year ago

0.7.0

2 years ago

0.5.13

2 years ago

0.6.0

2 years ago

0.5.11

2 years ago

0.5.12

2 years ago

0.5.10

2 years ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.9

2 years ago

0.5.4

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.3

3 years ago

0.5.0

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.4.9

3 years ago

0.4.8

3 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago