All Projects → jamesplease → Redux Resource

jamesplease / Redux Resource

Licence: other
3kb resource management for Redux

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Redux Resource

Awesome Design Systems
A curated list of bookmarks, resources and articles about design systems focused on developers.
Stars: ✭ 222 (-2.63%)
Mutual labels:  resources
Warp10 Platform
The Most Advanced Time Series Platform
Stars: ✭ 227 (-0.44%)
Mutual labels:  database
Pouchdb
🐨 - PouchDB is a pocket-sized database.
Stars: ✭ 14,625 (+6314.47%)
Mutual labels:  database
Books
Awesome Books
Stars: ✭ 3,242 (+1321.93%)
Mutual labels:  resources
Learn
A social network of lifelong learners built around humanity's universal learning map.
Stars: ✭ 224 (-1.75%)
Mutual labels:  resources
Db
Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
Stars: ✭ 2,832 (+1142.11%)
Mutual labels:  database
Omniscidb
OmniSciDB (formerly MapD Core)
Stars: ✭ 2,601 (+1040.79%)
Mutual labels:  database
Tdengine
An open-source big data platform designed and optimized for the Internet of Things (IoT).
Stars: ✭ 17,434 (+7546.49%)
Mutual labels:  database
Laravel World
provide countries, states, and cities relations and database.
Stars: ✭ 222 (-2.63%)
Mutual labels:  database
Liquibase
Main Liquibase Source
Stars: ✭ 2,910 (+1176.32%)
Mutual labels:  database
Portphp
Data import/export framework for PHP
Stars: ✭ 225 (-1.32%)
Mutual labels:  database
Sequoiadb
SequoiaDB is a distributed Multi-Model Database
Stars: ✭ 899 (+294.3%)
Mutual labels:  database
Flask Base
A simple Flask boilerplate app with SQLAlchemy, Redis, User Authentication, and more.
Stars: ✭ 2,680 (+1075.44%)
Mutual labels:  database
Storagekit
Your Data Storage Troubleshooter 🛠
Stars: ✭ 225 (-1.32%)
Mutual labels:  database
Realm Cocoa
Realm is a mobile database: a replacement for Core Data & SQLite
Stars: ✭ 14,778 (+6381.58%)
Mutual labels:  database
Curator
Apache Curator
Stars: ✭ 2,677 (+1074.12%)
Mutual labels:  database
Elastic
R client for the Elasticsearch HTTP API
Stars: ✭ 227 (-0.44%)
Mutual labels:  database
Firebase Esp8266
ESP8266 Firebase RTDB Arduino Library
Stars: ✭ 228 (+0%)
Mutual labels:  database
Sqlitebrowser
Official home of the DB Browser for SQLite (DB4S) project. Previously known as "SQLite Database Browser" and "Database Browser for SQLite". Website at:
Stars: ✭ 15,801 (+6830.26%)
Mutual labels:  database
Materialize
Materialize lets you ask questions of your live data, which it answers and then maintains for you as your data continue to change. The moment you need a refreshed answer, you can get it in milliseconds. Materialize is designed to help you interactively explore your streaming data, perform data warehousing analytics against live relational data, or just increase the freshness and reduce the load of your dashboard and monitoring tasks.
Stars: ✭ 3,341 (+1365.35%)
Mutual labels:  database

Redux Resource Logo

Redux Resource Travis Builds Redux Resource NPM Package Redux Resource NPM Download Count Redux Resource Code Coverage Redux Resource gzip Size

A tiny but powerful system for managing 'resources': data that is persisted to remote servers.

✓ Removes nearly all boilerplate code for remotely-stored data
✓ Incrementally adoptable
✓ Encourages best practices like normalized state
✓ Works well with APIs that adhere to standardized formats, such as JSON API
✓ Works well with APIs that don't adhere to standardized formats, too
✓ Integrates well with your favorite technologies: HTTP, gRPC, normalizr, redux-observable, redux-saga, and more
✓ Microscopic file size (3kb gzipped!)

Installation

To install the latest version:

npm install --save redux-resource

Documentation

View the documentation at redux-resource.js.org ⇗.

Looking for the v2.4.1 documentation? View it here.

Migration guides to the latest version can be found here.

Quick Start

Follow this guide to get a taste of what it's like to work with Redux Resource.

First, we set up our store with a "resource reducer," which is a reducer that manages the state for one type of resource. In this guide, our reducer will handle the data for our "books" resource.

import { createStore, combineReducers } from 'redux';
import { resourceReducer } from 'redux-resource';

const reducer = combineReducers({
  books: resourceReducer('books')
});

const store = createStore(reducer);

Once we have a store, we can start dispatching actions to it. In this example, we initiate a request to read a book with an ID of 24, then follow it up with an action representing success. There are two actions, because requests usually occur over a network, and therefore take time to complete.

import { actionTypes } from 'redux-resource';
import store from './store';

// This action represents beginning the request to read a book with ID of 24. This
// could represent the start of an HTTP request, for instance.
store.dispatch({
  type: actionTypes.READ_RESOURCES_PENDING,
  resourceType: 'books',
  resources: [24]
});

// Later, when the request succeeds, we dispatch the success action.
store.dispatch({
  type: actionTypes.READ_RESOURCES_SUCCEEDED,
  resourceType: 'books',
  // The `resources` list here is usually the response from an API call
  resources: [{
    id: 24,
    title: 'My Name is Red',
    releaseYear: 1998,
    author: 'Orhan Pamuk'
  }]
});

Later, in your view layer, you can access information about the status of this request. When it succeeds, accessing the returned book is straightforward.

import { getStatus } from 'redux-resource';
import store from './store';

const state = store.getState();
// The second argument to this method is a path into the state tree. This method
// protects you from needing to check for undefined values.
const readStatus = getStatus(store, 'books.meta[24].readStatus');

if (readStatus.pending) {
  console.log('The request is in flight.');
}

else if (readStatus.failed) {
  console.log('The request failed.');
}

else if (readStatus.succeeded) {
  const book = state.books.resources[24];

  console.log('The book was retrieved successfully, and here is the data:', book);
}

This is just a small sample of what it's like working with Redux Resource.

For a real-life webapp example that uses many more CRUD operations, check out the zero-boilerplate-redux webapp ⇗. This example project uses React, although Redux Resource works well with any view layer.

Repository Structure

This repository is a Lerna project. That means it's a single repository that allows us to control the publishing of a number of packages. The source for each package can be found in the ./packages directory.

Package Version Description
redux-resource npm version The main library
redux-resource-xhr npm version A library that exports a powerful HTTP CRUD action creator
redux-resource-plugins npm version A collection of common plugins
redux-resource-prop-types npm version Handy Prop Types to use with Redux Resource
redux-resource-action-creators npm version Unopinionated action creators for Redux Resource (bring your own HTTP request)

Contributing

Thanks for your interest in helping out! Check out the Contributing Guide, which covers everything you'll need to get up and running.

Contributors

(Emoji key)


James, please

💻 🔌 📖 🤔

Stephen Rivas JR

💻 📖 🤔 🔌

Ian Stewart

🤔

Tim Branyen

🤔

Jason Laster

🤔

marlonpp

🤔

Javier Porrero

🤔

Smai Fullerton

📖

vinodkl

🤔

Eric Valadas

📖

Jeremy Fairbank

🚇

Yihang Ho

💻

Bryce Reynolds

💡

Ben Creasy

📖

Guillaume Jasmin

💻 🔌

This project follows the all-contributors specification. Contributions of any kind are welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].