Redux Rest Resource
  • Read Me
  • Usage
    • Quickstart
  • Basics
    • Resources
    • Actions
    • Reducers
    • Types
  • Examples
    • Actions
  • Advanced
    • Custom Actions
    • Pure Actions
    • Single Action Helper
    • Headers Override
    • Transform Response
    • Assign Update Response
    • Resource Combination
    • Custom Promise
    • Custom fetch
  • Defaults
    • Actions
    • Headers
    • State
  • Changelog
Powered by GitBook
On this page
  1. Basics

Reducers

Reducers are pure functions that takes the previous state and an action, and returns the next state.

(previousState, action) => newState;

Exported store state

Redux REST Resource will manage the state for you and store related data inside it. You have state-related booleans (like isFetching) that enables smooth UI feedback.

import {initialState} from 'redux-rest-resource';

initialState ==
  {
    // FETCH props
    items: [],
    isFetching: false,
    lastUpdated: 0,
    didInvalidate: true,
    // GET props
    item: null,
    isFetchingItem: false,
    lastUpdatedItem: 0,
    didInvalidateItem: true,
    // CREATE props
    isCreating: false,
    // UPDATE props
    isUpdating: false,
    isUpdatingMany: false,
    // DELETE props
    isDeleting: false,
    isDeletingMany: false
  };
PreviousActionsNextTypes

Last updated 6 years ago