use-saga
v0.1.0
Published
Implementation ideas:
Downloads
3
Readme
use-saga
React Hook
Implementation ideas:
import useSaga, { take } from "use-saga";
import makeChan, { makeNamedChannel } from "use-saga/channel";
const App = () => {
const [orders, setOrders] = useState([]);
const chan = makeNamedChannel("app/new-orders");
useSaga(function*() {
while (yield take(chan)) {
const result = yield loadOrders();
setOrders(result.orders);
yield delay(500);
}
});
};