hooks-cofx
v1.0.0
Published
Use cofx with react hooks
Downloads
2
Readme
hooks-cofx
Use cofx
with react hooks
import useCofx from 'hooks-cofx';
function* fetchMovies() {
const resp = yield call(fetch, '/movies');
const json = yield call([resp, 'json']);
return json;
}
const App = () => {
const { loading, error, value } = useCofx(fetchMovies);
if (loading) {
return <div>Loading ...</div>
}
if (error) {
return <div>Error: {value}</div>
}
return <div>{value}</div>
};
See cofx for more information on what cofx
can do