react-flowder
v1.0.1
Published
data loader for react
Downloads
94
Maintainers
Readme
react-flowder
A library that connects rxjs to React and uses suspense to load data on the first subscribe.
Usage
import React, { Suspense } from "react";
import { render } from "react-dom";
import { interval } from "rxjs";
import { datasource, useReadData, Provider } from "@naporin0624/react-flowder";
const timer = datasource(() => interval(1000));
const Timer = () => {
const time = useReadData(timer());
return (
<div>
<p>time: {time}</p>
</div>
);
};
const App = () => (
<Provider>
<Suspense fallback={<p>loading</p>}>
<Timer />
</Suspense>
</Provider>
);
export default App;
LICENSE
MIT