subjecto-react
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Subjecto React

React hook wrapper for Subjecto observables.

Installation

npm install subjecto-react

Usage

import { SubjectWithHook } from "subjecto-react";

// create a subject
const $count = new SubjectWithHook(0);

const App: React.FC = () => {
  // subscribe
  const count = $count.hook();
  return (
    <div className="app">
      <p>Count: {count}</p>
      <button onClick={() => $count.next(count + 1)}>Increment</button>
    </div>
  );
};

License

MIT

Package Sidebar

Install

npm i subjecto-react

Weekly Downloads

9

Version

0.0.3

License

ISC

Unpacked Size

6.98 kB

Total Files

6

Last publish

Collaborators

  • aelythe