Skip to content

React integration for Nano Stores, a tiny state manager with many atomic tree-shakable stores

License

Notifications You must be signed in to change notification settings

nanostores/react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Dec 18, 2024
34a8102 · Dec 18, 2024
Dec 18, 2024
Dec 18, 2024
Oct 14, 2021
Mar 29, 2022
Mar 29, 2022
Dec 18, 2024
Oct 14, 2021
Jun 25, 2024
Jun 1, 2024
Sep 23, 2024
Dec 18, 2024
Dec 18, 2024
Dec 18, 2024
Apr 12, 2023

Repository files navigation

Nano Stores React

React integration for Nano Stores, a tiny state manager with many atomic tree-shakable stores.

  • Small. Less than 1 KB. Zero dependencies.
  • 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. The chunk contains only stores used by components in the chunk.
  • Was designed to move logic from components to stores.
  • It has good TypeScript support.
import { useStore } from '@nanostores/react'

import { profile } from '../stores/profile.js'

export const Header = () => {
  const { userId } = useStore(profile)
  return <header>{currentUser.name}</header>
}

Made at Evil Martians, product consulting for developer tools.