1.17.1 • Published 4 years ago

redux-library v1.17.1

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

npm.io

Table of Contents

Overview

In your average, mildly sophisticated React app, getting and updating data against an API is half the battle. If you've felt the pain of redundant code filling up all your component lifecycle methods - in order to fill your UI with data - then this library is for you.

Pohleusis is a small library that helps you with the 3 most annoying parts:

  1. Getting data from a spec-compliant JSON API
  2. Getting "nested" data off of relationships
  3. Managing i18n localization of your data

By colocating all of the above in one place, Formik will keep things organized - making testing, refactoring, and reasoning about your forms a breeze.

Developer Experience

I (@morgs32) wrote Pohleusis while building www.stackshirts.com.

When half the code for our components had to do with GET/PATCH/PUT/DELETE methods against our API, it quickly became obvious that we could benefit by standardizing not just our display of the data, but also the way in which data flowed into and out of our app.

This is a design system for your data.

Before you get started

You have to have a JSON API. Check out the spec. If you do not think your own API makes more sense as a completely compliant JSON API, raise an issue here - I want to know about it.

Not only does it build consistency into your API, it builds consistency into the way you use the data from the API. You'll never confuse which fields are relationships to other data. You'll never have to guess where to go looking for it.

In some ways, the JSON API spec is a simpler, more intuitive way to accomplish what many people use GraphQL to do - get all the data you need for a given block of UI in one request. Check out the JSON API way to include related resources.

So start building your API according to spec immediately.

Who's got a valid JSON API?

Demos & Examples

Two examples (in the examples/ directory here and on codesandbox):

Getting Started

Components

Get

Query

Localization

Dispatchers

wrapCreate

wrapUpdate

wrapDestroy

Contribution Guide

  • Just make sure to use conventional commits.
  • From root directory

    yarn watch
  • I recommend developing against either of the examples:

    cd examples/valid-api-spec
    yarn
    yarn dev
  If you're going to develop against another app (using `yarn link`)
  then make sure to link back to your own app's react/redux modules:
  "devDependencies": {
    ...
    "react": "link:../../stackshirts/app/node_modules/react",
    "react-redux": "link:../../stackshirts/app/node_modules/react-redux",
    "redux": "link:../../stackshirts/app/node_modules/redux"
  }

Todo List