Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

use-cofx

neurosnap28MIT1.0.1TypeScript support: included

Use cofx with react hooks

readme

use-cofx Build Status

Use cofx with react hooks

import useCofx from 'use-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