This package has been deprecated

Author message:

No longer supported

@mr-luke/vredux

0.1.1-beta.1 • Public • Published

@mr-luke/vRedux

This is RxJS implementation of Redux with build-in async ActionCreator for Angular2.

Installation

npm install @mr-luke/vredux

Basic Usage

import { VReduxModule } from '@mr-luke/vredux';

export const initState = {
    stateKey: 0/* Init value of stateKey */
};
export const reducer = (state, action) => {
    switch (action.type) {
        // Compose your reducer like for Redux
        // Don't forget to return state for default
        default:
            return state;
    }
};

@NgModule({
    imports: [
        BrowserModule,
        VReduxModule.forRoot({ stateKey: reducer }, initState);
    ]
})
export class AppModule {}

VReduxModule.forRoot(reducers: Object, initState); Notice! Don't use vReduxModule alone during import. Constructing redux vStore require .forRoot()

import { Component } from '@angular/core';
import { VStore } from '@mr-luke/vRedux';

@Component({
    selector: 'app-root',
    template: '<h1>{{ statePart | async }}</h1>'
})
export class AppComponent {

    public statePart: any;

    constructor(private store: VStore){
        this.statePart = this.store.select('stateKey');
    }

}

Tests

npm run test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Readme

Keywords

Package Sidebar

Install

npm i @mr-luke/vredux

Weekly Downloads

0

Version

0.1.1-beta.1

License

ISC

Last publish

Collaborators

  • mr-luke