@shared-state/core
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@shared-state/core

The core package of @shared-state

Quick Start

Install @shared-state/core

pnpm install @shared-state/core

Example

Basic

import { createSharedState } from "@shared-state/core";

const CountState = createSharedState(0);

CountState.get(); // Get value

CountState.set((count) => count + 1); // Set value

const onSharedStateChange = ({ previousState, nextState }) =>
  console.log(previousState, nextState)

CountState.subscribe(onSharedStateChange); // Subscribe state

CountState.unsubscribe(onSharedStateChange)

Readme

Keywords

Package Sidebar

Install

npm i @shared-state/core

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.24 kB

Total Files

8

Last publish

Collaborators

  • lmarklil