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

2.0.0-alpha.0 • Public • Published

⚛️ Nuclear React

Nuclear Core's bindings for React.

Installation

npm install @alesmenzel/nuclear-core @alesmenzel/nuclear-react

Usage

See @alesmenzel/nuclear-core documentation.

useAtom

Hook useAtom is used to subscribe React component to the atom's state. Whenever the atom's value changes, the subscribed React components will re-render as well.

import { atom } from '@alesmenzel/nuclear-core';
import { useAtom } from '@alesmenzel/nuclear-react';

const Counter = () => {
  const [count, setCount, countAtom] = useAtom(() => atom(100));

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

Readme

Keywords

none

Package Sidebar

Install

npm i @alesmenzel/nuclear-react

Weekly Downloads

1

Version

2.0.0-alpha.0

License

MIT

Unpacked Size

8.26 kB

Total Files

11

Last publish

Collaborators

  • alesmenzel