Miss any of our Open RFC calls?Watch the recordings here! »

genjijs

0.3.0 • Public • Published

English | 简体中文

Genji

npm version CircleCI Coverage Status dependencies Status devDependencies Status downloads

A super-lightweight (core code only 5KB) data state management scheme based on redux and redux-thunk. (Inspired by dva )


竜神の剣を喰らえ! -- shimada genji


Features 🆕

  • Use namespaces to separate different businesses, and centralize all data processing logic belong to the common namespace in the same place. to facilitate unified data management and provide a pluggable experience for modules.
  • Enhanced actionCreator of redux to provide a more friendly data access methods. Users do not need to write reducer repeatedly. Unified synchronous and asynchronous experience in updating state.
  • The built-in loading state for asynchronous operation makes it easier to get the current operation progress.

Installation ⚙️

Assuming you are using npm as your package manager, execute the following command in your project directory:

npm install --save genjijs

If you use yarn, you can also:

yarn add genjijs

Quick Start 🔰

There is a simple example in this project which used all common features of Genji . Click here to see。

In addition, the following demo may help you become more familiar with Genji :

  • example-typescript:If you want to have full Typescript supports, refer this.

  • TodoList:A copy of TodoList given by example from Redux project, but use Genji to rewrite.


Q & A 📖

  • ### Difference from dva

dva is an excellent open source project worldwide, and is also the source of inspiration for this project (this can be seen from the project name). Specially thanks to dva.

In the dva project, redux-saga is used as an asynchronous solution, which makes developers have to use the generator feature to make asynchronous requests, which is different from the mainstream asynchronous invocation methods which used async and Promise , and these may cause some confusion for junior developers. Therefore, in Genji, the redux-thunk written by Dan, the author of Redux, was adopted as our asynchronous solution.

Considering the user habits and functional enhancements brought by redux-saga, we have enhanced the capabilities of redux-thunk by hijack & injection, so that users can define asynchronous function like redux-saga but have supports of async and Promise.

TODO 🚧

  • Built-in loading state for asynchronous operation
  • Added save and pick methods for effects to access state
    • Create the reducer asynchronously and inject it into the original reducer tree
    • Extend redux-thunk and hijack dispatch, to extend parameter in
    • Implement save & pick
    • Enhance save & pick, like get&set from other model or support parsing more parameter types
  • Add Continuous integration, eslint, and unit test.
  • Integrate reducers & effects
  • Rewrite Aciton Type, to support definition jumps & smart tips
  • A full support of Typescript
  • Document

LICENSE

MIT

Install

npm i genjijs

DownloadsWeekly Downloads

0

Version

0.3.0

License

MIT

Unpacked Size

74.4 kB

Total Files

27

Last publish

Collaborators

  • avatar