react-lantern
Illuminate data management through delcarative react components. It doesn't include any fancy http clients or switching methods and instead relies soley on fetch (for now).
Installation
yarn add react-lantern
npm install --save react-lantern
Fetch polyfill and furture signal support
Depending on your use case you may need to polyfill fetch.
There is also a good chance that future releases of this library will rely on AbortController which has somewhat limited support. whatwg-fetch
does not polyfill for AbortController so another polyfill will be needed.
Usage
; ; const FetchingAllDay = <FetchProvider baseUrl="https://jsonplaceholder.typicode.com"> <Get path="/posts"> { if loading return <div>Loading...</div>; if error return <div>Error...</div>; return data; } </Get> </FetchProvider>;