A library for generating Redux actions and reducers from API endpoint definitions, eliminating boilerplate for AJAX calls. The current stable version is 0.12.0. It supports flexible adapters for making HTTP requests (default: isomorphic-fetch) and transformers for response data. Key differentiators: it handles endpoint configuration with URL parameters, provides scoping for multiple instances, and does not prescribe a specific HTTP library. Release cadence is low; updates are infrequent. Compared to alternatives like redux-rest, it offers a simpler API and adapter pattern.
npm install redux-apiNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates defining API endpoints with redux-api, setting up Redux store with thunk middleware, and dispatching an action to fetch data.
npm install isomorphic-fetch --save and import 'isomorphic-fetch' at entry point.
Update state references to use state.endpointName.data instead of state.endpointName.
Use { url: '/api/v1/entry/:id' } instead of just '/api/v1/entry/:id'.Ensure applyMiddleware(thunk) is applied to the store if using promise-based dispatch.
Provide fetch function (e.g., from isomorphic-fetch) as argument: adapterFetch(fetch).
Apply thunk middleware: const store = createStore(reducer, applyMiddleware(thunk));
Call .use('fetch', adapterFetch(fetch)) before using the reduxApi instance.Use 'import adapterFetch from 'redux-api/lib/adapters/fetch'' instead of destructuring.
Access state.endpointName.data instead of state.endpointName.