1.0.1 • Published 4 years ago

react-state-render-prop v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

React State Render Prop

A component for introducing state through render props. Especially useful for controlling arrays of controlled components. Written in TypeScript.

Installation

yarn add react-state-render-prop

or

npm i react-state-render-prop

Usage

import { State } from 'react-state-render-prop';

const Example = () => {
  return (
    <div>
      <State initialState={0}>
        {(state, setState) => (
          <button onClick={() => setState(state => state + 1)}>{state}</button>
        )}
      </State>
    </div>
  );
};
1.0.1

4 years ago

1.0.0

4 years ago

0.1.0

4 years ago