louis-xiv

0.0.2 • Public • Published

The state? I am the state.

— Louis XIV

Usage npm version

Install:

$ yarn add louis-xiv

Use:

import React from "react";
import State from "louis-xiv";
 
const App = () => (
  <State
    init={{ counter: 0 }}
    map={(state, setState, deferredSetState) => ({
      ...state,
      increment: () => setState(prev => ({ counter: prev.counter + 1 }))
    })}
  >
    {({ counter, increment }, setState, deferredSetState) => (
      <div>
        <h1>{counter}</h1>
        <button onClick={increment}>+</button>
      </div>
    )}
  </State>
);

License

Released under MIT license.

Package Sidebar

Install

npm i louis-xiv

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

13 kB

Total Files

12

Last publish

Collaborators

  • pomber