react-state-render-prop
v1.0.1
Published
A component for introducing state through render props. Especially useful for controlling arrays of controlled components. Written in TypeScript.
Downloads
5
Maintainers
Readme
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>
);
};