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

1.1.0 • Public • Published

@shared-state/react

This package provides a series of APIs for using Shared State via React

Quick Start

Install @shared-state/core and @shared-state/react

pnpm install @shared-state/core @shared-state/react

Example

Using with Function Component

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

const sharedCount = createSharedState(0);

function Counter() {
  const [count, setCount] = useSharedState(sharedCount);

  return (
    <button onClick={() => setCount((count) => count + 1)}>{count}</button>
  );
}

Readme

Keywords

Package Sidebar

Install

npm i @shared-state/react

Weekly Downloads

50

Version

1.1.0

License

MIT

Unpacked Size

53 kB

Total Files

9

Last publish

Collaborators

  • lmarklil