1.0.3 • Published 6 years ago

reaktion v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Build Status Coverage Status License: MIT

Use the same API as useState React hook for transverse state management :muscle:

Usage

Installation

Make sure you run in a project using React v16.7 or higher

$ yarn add reaktion

In your code

import { Reaktion, useStore } from "reaktion";

const Hello = () => {
  /**
   * The first element is the state node
   * The second element is a function that mutates only that node
   **/
  const [name, setName] = useStore("name");

  return <button onClick={() => setName("Marvin")}>Hello {name}</button>;
};

/**
 * Initial transverse node
 **/
const initialState = { name: "World" };

const App = () => {
  /**
   * Reaktion is the state provider. It must be placed at a top level of your app
   **/
  return (
    <Reaktion initialState={initialState}>
      <Hello />
    </Reaktion>
  );
};
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago