redux-loadings


Keywords
react, region-core, region-shortcut, redux-loadings, redux
License
MIT
Install
npm install redux-loadings@0.6.5

Documentation

redux-loadings renamed to region-shortcut!!!

version npm downloads codecov MIT License

A replacement tool of redux to handle sync & async action flow. Extremely simple API!

English | 中文

Package Version Docs Description
region-core version The core of Region: set, load & connect
region-shortcut version Wrapped core with global Provider, set, load & connect
region-form version RegionForm extends Region: bindWith any ant-design form item

Get Started

npm i region-shortcut
// or
npm i region-core

Then create your Component

import { connectWith } from 'region-shortcut';
import { fetchUser } from './fetch'; // somewhere with axios

load('user', fetchUser);

const Display = ({ user }) => <div>{user}</div>

export default connectWith('user', Display);

or

import { connectWith } from 'region-shortcut';
import { fetchUser, fetchFollower } from './fetch'; // somewhere with axios

load('user', fetchUser);
const handleClick = () => load('follower', fetchFollower);

const Display = ({ loading, error, user, follower }) => (
  <div>
    {user}
    {follower}
    <Button loading={loading} onClick={handleClick} />
  </div>
);

export default connectWith(['user', 'follower'], Display);

Docs

Document And Best Practices

Migrate Guide

ChangeLog

Example

Online Example

git clone https://github.com/regionjs/region-core.git
cd example
npm i
npm start

Contribute

Region is Extremely easy to extend, fire a issue if you have some great idea.

import { Region } from 'region-core';

class MyRegion extends Region {
  constructor(...args) {
    super(...args);
    this.someFunc = this.someFunc.bind(this); // in case you are not using class field
  }

  someFunc() {}
}

As for pull request, make sure to add test for your code.