JSPM

  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q65720F
  • License MIT

region-core

Package Exports

  • region-core

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (region-core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

region-core

version npm downloads codecov MIT License

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

English | 中文

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.

TODO

  • release 1.0 when everything is ready, push package-lock.json then
  • new site
  • replace badge