Registry / devops / redux-axios-reducers

redux-axios-reducers

JSON →
library0.3.20jsnpmunverified

Redux reducers for fetching data with Axios HTTP client. Current stable version is 0.3.20. This library provides AxiosReducer and AxiosRestReducer classes that generate Redux reducers and async thunk actions for common CRUD operations (GET, POST, PUT, PATCH, DELETE). It depends on redux and redux-thunk, and integrates with Axios. The library is no longer actively maintained and has not been updated since 2017. Use with caution in new projects; consider modern alternatives like RTK Query or React Query for data fetching.

npm install redux-axios-reducers
INSTALL
IMPORT
SIG · REDUX-AXIOS-REDUCE
R
redux-axios-reducers
devopsjavascriptv0.3.20
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AxiosReducer
import { AxiosReducer } from 'redux-axios-reducers'
const { AxiosReducer } = require('redux-axios-reducers')
Named export, not default. Works with both ESM and CJS.
AxiosRestReducer
import { AxiosRestReducer } from 'redux-axios-reducers'
import AxiosRestReducer from 'redux-axios-reducers'
Named export. AxiosRestReducer is an extended version with RESTful methods.
AxiosReducer instance
const usersReducer = new AxiosReducer({ name: 'users' })
const usersReducer = AxiosReducer({ name: 'users' })
Must be instantiated with 'new'. The 'name' option is required.

Shows setup of AxiosReducer with Redux store, redux-thunk middleware, and dispatching a GET action.

import { createStore, combineReducers, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import axios from 'axios'; import { AxiosReducer } from 'redux-axios-reducers'; const client = axios.create({ baseURL: 'http://localhost:8080/api', responseType: 'json' }); const usersReducer = new AxiosReducer({ name: 'users' }); const rootReducer = combineReducers({ users: usersReducer.configure({ axios: client }), }); const store = createStore(rootReducer, applyMiddleware(thunk)); // Dispatch a GET request store.dispatch(usersReducer.get()).then(() => { console.log('Users fetched:', store.getState().users); });
Debug
Known issues
deprecatedNo updates since 2017; consider using modern alternatives like RTK Query or React Query.
fix
Migrate to a more maintained library for data fetching with Redux.
affects: >=0.1.0
gotchaMust call reducer.configure({ axios: client }) to attach the axios instance before dispatching.
fix
Ensure configure is called in the combineReducers setup.
affects: >=0.1.0
gotchaThe library uses redux-thunk; if not included, actions will not dispatch correctly.
fix
Install redux-thunk and apply middleware: applyMiddleware(thunk)
affects: >=0.1.0
breakingBreaking change in version 0.2.0: TYPES shape changed from UPPERCASE to ASYNC/${name}/...
fix
Update any code referring to old TYPES (e.g., 'ASYNC_USERS_FETCHING' -> 'ASYNC/users/FETCHING').
affects: >=0.2.0
Errors
Common errors & fixes
Uncaught TypeError: Cannot read property 'getState' of undefined
Thunk middleware not applied to store
fix
Use applyMiddleware(thunk) when creating store
Uncaught TypeError: reducer.configure is not a function
Forgot to instantiate AxiosReducer with 'new'
fix
Use 'new AxiosReducer({ name: 'users' })'
Actions must be plain objects. Use custom middleware for async actions.
redux-thunk not installed or not applied
fix
Install redux-thunk and add to middleware: applyMiddleware(thunk)
Upgrade
Version history
0.3.20latest on npm
Audit
Dependencies
reduxrequiredPeer dependency for store and reducers
redux-thunkrequiredPeer dependency for async action dispatching
axiosrequiredHTTP client for API requests
Agent activity
8 hits · last 30 days
node
8
Resources
redux-axios-reducers — npm install redux-axios-reducers · libregistry