0.0.2 • Published 6 years ago

react-functional-state v0.0.2

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

React functional state

Install

    npm i --save react-functional-state

Usage

import functionalState from 'react-functional-state';

function StatelessButton({state, setState}) {
  return (
    <button onClick={() => setState({value: state.value + 1})}>
      Click to increment the value: {state.value}
    </button>
  );
}

const StatefulButton = functionalState({value: 1})(StatelessButton);

As simple as that