Skip to content

Simplify redux boilerplate code when using redux-observable(RxJS)

Notifications You must be signed in to change notification settings

abdvl/Redux-Observable-Scaffold

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Redux Observable Scaffold

There are too much boilerplate code in react&redux project.

Simplify the action &reducer creation and fully utlize redux-observable and rx.js. That could be this simple:

import 'rxjs';
import {create} from 'redux-scaffold';

const INITIAL_STATE = {
    state: "Complete",
    data: []
};

export let {Types, Actions, Reducer} = create(INITIAL_STATE, {
    "update_listing_state": ["state"],
    "update_listing_data": ["data"]
});

export default {Types, Actions, Reducer, INITIAL_STATE}

And

import {combineReducers} from "redux";
import {routerReducer} from "react-router-redux";
import {combine} from 'redux-scaffold';

//import epic
import listing from "../epic-listing";

//create root reducer
export const reducer = combineReducers({
    routing: routerReducer,
    "listing": combine(listing.Reducer)
});

// create initial state
export const initialState = {
    "listing": listing.INITIAL_STATE
};

About

Simplify redux boilerplate code when using redux-observable(RxJS)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published