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

2.0.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>
  );
}

/@shared-state/react/

    Package Sidebar

    Install

    npm i @shared-state/react

    Weekly Downloads

    1

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    33.9 kB

    Total Files

    8

    Last publish

    Collaborators

    • lmarklil