@halfeld/use-reactive-state
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

useReactiveState(🔥)

Data binding incorporation in React world.

demo

How to install

npm install @halfeld/use-reactive-state

How to use

import React from 'react';
import { useReactiveState } from '@halfeld/use-reactive-state';

const App = () => {
  let count = useReactiveState({ value: 0 });

  function updateCount(value: number) {
    count.value = value;
  }

  return (
    <div>
      <h1>{count.value}</h1>
      <div>
        <button onClick={(): void => updateCount(count.value - 1)}>Less</button>
        <button onClick={(): void => updateCount(count.value + 1)}>More</button>
      </div>
    </div>
  );
}

Package Sidebar

Install

npm i @halfeld/use-reactive-state

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

2.39 kB

Total Files

4

Last publish

Collaborators

  • halfeld