genjijs-umd
v0.3.0
Published
Explore a better way to manage data state
Downloads
8
Readme
English | 简体中文
Genji
A super-lightweight (core code only 5KB) data state management scheme based on redux
and redux-thunk
. (Inspired by dva )
竜神の剣を喰らえ! -- shimada genji
Features :new:
- 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
ofredux
to provide a more friendly data access methods. Users do not need to writereducer
repeatedly. Unified synchronous and asynchronous experience in updatingstate
. - The built-in
loading
state for asynchronous operation makes it easier to get the current operation progress.
Installation :gear:
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 :beginner:
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 useGenji
to rewrite.
Q & A :book:
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 :construction:
- [x] Built-in
loading
state for asynchronous operation - [x] Added
save
andpick
methods for effects to access state- [x] Create the
reducer
asynchronously and inject it into the originalreducer tree
- [x] Extend
redux-thunk
and hijackdispatch
, to extend parameter in - [x] Implement
save
&pick
- [ ] Enhance
save
&pick
, like get&set from other model or support parsing more parameter types
- [x] Create the
- [x] Add Continuous integration, eslint, and unit test.
- [x] Integrate
reducers
&effects
- [x] Rewrite
Aciton Type
, to support definition jumps & smart tips - [x] A full support of
Typescript
- [ ] Document