Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

I am a good old fan of spring core context DI and redux-anno is my first try to set up something similar in the Redux World.

NotificationsYou must be signed in to change notification settings

albertleigh/redux-anno

Repository files navigation

A middleware leverages certain boilerplate while using redux

npm versionBuild StatusCoverage StatusCode style

This is a very early release of this package, do not suggest using it in production till latter stable version

I am a good old fan of spring core context DI and redux-anno is my first try to set up something similar in the Redux World.

A Simple Counter Example showing what I am trying to do

import{Model,State,Saga,createState,initReduxAnno,getContext}from'redux-anno';import{putResolve}from'redux-saga/effects';@Model()exportclassCounter{  @Statecount=createState(0asnumber);  @Saga()*updateCount(nextVal:number){yieldputResolve(this.count.create(nextVal));}}describe('CounterModel',()=>{beforeAll(()=>{initReduxAnno({entryModel:Counter,});});it('counter 01',async()=>{constdefaultCtx=getContext();constcounterInst=defaultCtx.getOneInstance(Counter);expect(counterInst.count.value).toBe(0);awaitcounterInst.updateCount.dispatch(1);expect(counterInst.count.value).toBe(1);});});

For more info and details, please check the sample applicationexamples/react-sample-app for now;

More detailed docs are incoming~

About

I am a good old fan of spring core context DI and redux-anno is my first try to set up something similar in the Redux World.

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp