useCallbag
ezekielchentnik opened this issue · 1 comments
ezekielchentnik commented
import subscribe from 'callbag-subscribe';
import { useEffect, useState } from 'react';
export default function useCallbag(factory) {
const [state, setState] = useState();
useEffect(() => subscribe(setState)(factory()), []);
return state;
}
jeetiss commented
already exist
https://github.com/Andarist/use-callbag