This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

observable-fetch

1.1.1 • Public • Published

observable-fetch

RxJS Observable wrapped around the WHATWG Fetch API.

NPM version Build Status

Installation

$ yarn add observable-fetch

Alternatively using npm:

$ npm i observable-fetch --save

Usage

This library is especially built to be complementary to redux-observable;

import fetch from 'observable-fetch';
 
// action creators
const fetchUser = username => ({ type: FETCH_USER, payload: username });
const fetchUserFulfilled = payload => ({ type: FETCH_USER_FULFILLED, payload });
 
// epic
const fetchUserEpic = action$ =>
  action$.ofType(FETCH_USER)
    .mergeMap(action =>
      fetch(`https://api.github.com/users/${action.payload}`)
        .map(response => fetchUserFulfilled(response))
    );
 
// later...
dispatch(fetchUser('torvalds'));

License

MIT © Robin van der Vleuten

Readme

Keywords

Package Sidebar

Install

npm i observable-fetch

Weekly Downloads

3

Version

1.1.1

License

MIT

Last publish

Collaborators

  • robinvdvleuten