louis-xiv
React state as a component
Last updated 3 years ago by pomber .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install louis-xiv 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 0.0.2                                ...           latest (3 years ago)

2 Versions

  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |