lensalot
Lens approach to global react state via Hooks
Install
npm install --save lensalot #or yarn add lensalot
Usage
import React from 'react';import LensProvider useLens from 'lensalot'; const state = logic: foo: false count: 0 ; const Count = const count = ; return <p>count</p>;; const Increment = const count setCount = ; return <button =>+</button>;; const Toggle = const foo setFoo = ; return <button =>foo ? 'foo' : 'bar'</button>;; const Logic = const logic = ; return <p>JSON</p>;; { return <LensProvider => <Count /> <Increment /> <Toggle /> <Logic /> </LensProvider> ;}
License
MIT © oakfang