npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redux-rest-tools

v0.7.3

Published

Redux tools to handle REST requests

Downloads

81

Readme

Redux REST tools

build status npm version downloads per month

Redux REST tools is an opinionated library to handle API calls in Redux apps. It provides action creators, reducers generator, state normalization and a middleware to handle the request flow... with the REST convention in mind. It is meant to ease HTTP requests and data handling while ensuring performance and state consistency.

REST action creators use redux-actions under the hood to create FSA-complient set of actions. For each request, a request, success and fail action creator will be generate with the possibility to pass success/failure handlers to deal with the consequences of a successful/failed API request.

REST reducers use immutable objects for their slice of the state (but the whole state is not required to se immutable). They handle immutable and JS action payloads for state update, but immutable data structure are preferred to increase state update performance and reduce from/to JS conversion efforts (note: in a React app, you might avoid using toJS() in mapStateToProps to speed up UI refresh pace).

Each state slice managed by a REST reducer is normalized based on the entities' unique identifiers (e.g. the object ID, see idPath). Their shapes look like { result: [...], entities: {...}, ui: {...}, errors: {...} }, where result is the list of entity IDs, entities is an object where each key is an entity ID and its content is the entity itself, ui is used to store request states, and errors the errors that may occur during the API calls.

The REST middleware handles the async request flow. It starts with a request action triggering the actual HTTP request using axios. If the request succeed, the success action is dispatched; else the fail action is dispatched. To deal with the consequences of a successful/failed request, you may pass onSuccessAction/onFailAction action creators and onSuccess/onFail function in the request action meta to be called with the request results.

Installation

To install the stable version with npm:

npm install --save redux-rest-tools

or with yarn:

yarn add redux-rest-tools

Usage

Coming soon...

Documentation

See full documentation

Contribution & Feedback

redux-rest-tools is at an early stage of development. You are more than welcome to provide feedback and contribute to the development of the project.

Please search the existing issues to follow up on open/closed discussions.

License

MIT