Permalink
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (14 sloc) 292 Bytes

createState()

Create a state container.

Usage

import {createState} from 'libreact/lib/shim';

const State = createState({
  cnt: 1,
});

<State>{(state, setState) =>
  <button onClick={() => setState({cnt: state.cnt + 1})}>
    Clicks: {state.cnt}
  </button>
}</State>