react-functional-state

0.0.2 • Public • Published

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

Package Sidebar

Install

npm i react-functional-state

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

6.61 kB

Total Files

4

Last publish

Collaborators

  • nancio