react-state-render-prop
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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>
  );
};

Package Sidebar

Install

npm i react-state-render-prop

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

8.88 kB

Total Files

15

Last publish

Collaborators

  • andrewprifer