ReSift

ReSift

  • Docs
  • API
  • Help
  • GitHub

›Guides

Introduction

  • What is ReSift?
  • Installation

Tutorial

  • ReSift Rentals

Main Concepts

  • What's a fetch?
  • How to define a fetch
  • Making state consistent
  • Making sense of statuses
  • What are data services?
  • Error handling
  • Custom hooks

Examples

  • ReSift Notes (CRUD)
  • Infinite scroll
  • Custom hooks and React Router

Guides

  • ReSift vs Apollo and Relay
  • HTTP proxies
  • Usage with TypeScript
  • Usage with Redux
  • Usage with classes

API

  • About these docs
  • useStatus
  • useError
  • useDispatch
  • useData
  • useClearFetch
  • isUnknown
  • isNormal
  • isLoading
  • isError
  • defineFetch
  • dataServiceReducer
  • createStoreKey
  • createHttpService
  • createHttpProxy
  • createDataService
  • createActionType
  • combineStatuses
  • ResiftProvider
  • Guard
  • CanceledError
  • UNKNOWN
  • NORMAL
  • LOADING
  • ERROR
Edit

Usage with Redux

The installation is a bit different if you're already using Redux. Please follow this guide only if you're already using Redux. If you're not please follow the normal installation.

We'll most likely be moving away from a Redux implementation. See here.

Create the data service as you normally…

import { createDataService } from 'resift';

const dataService = createDataService(/* ... */);

export default dataService;

…but instead of adding in the ReSift provider, add the data service as a middleware.

import { createStore, applyMiddleware } from 'redux';
import dataService from './dataService';
import rootReducer from './rootReducer';

const store = createStore(rootReducer, {}, applyMiddleware(dataService));

Lastly, add the reducer dataService to the root reducer from dataServiceReducer:

import { dataServiceReducer } from 'resift';
import { combineReducers } from 'redux';

const rootReducer = combineReducers({
  // ...
  dataService: dataServiceReducer,
  // ...
});

export default rootReducer;

That's it!

Last updated on 11/2/2019
← Usage with TypeScriptUsage with classes →
ReSift
Docs
What is ReSift?What's a fetch?API
Community
Ask a questionOpen an issue@ meLeave feedback
More
StarBuild StatusCoverage Status
Copyright © 2021 Sift
www.justsift.com