Skip to content

Commit

Permalink
home.jsx Cannot read property 'data' of undefined (#30)
Browse files Browse the repository at this point in the history
* changed combine reducers to fix Cannot read property 'data' of undefined

* fixed linting errors
  • Loading branch information
ibulmer authored and ananavati committed Oct 14, 2016
1 parent c1ef4cb commit 54aa40f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions .isomorphic-loader-config.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lock
8 changes: 4 additions & 4 deletions client/app.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from "react";
import { routes } from "./routes";
import { Router } from "react-router";
import { Router, browserHistory } from "react-router";
import { createStore, compose } from "redux";
import { Resolver } from "react-resolver";
import { createHistory } from "history";
import { Provider } from "react-redux";
import "styles/base.css";
import rootReducer from "./reducers/index";

import DevTools from "../client/devtools";

const initialState = window.__PRELOADED_STATE__;

const rootReducer = (s, a) => s; // eslint-disable-line no-unused-vars
// const rootReducer = (s, a) => s; // eslint-disable-line no-unused-vars

const enhancer = compose(
// Add middlewares you want to use in development:
Expand All @@ -26,7 +26,7 @@ window.webappStart = () => {
() =>
<Provider store={store}>
<div>
<Router history={createHistory()}>{routes}</Router>
<Router history={browserHistory}>{routes}</Router>
<DevTools />
</div>
</Provider>,
Expand Down
8 changes: 8 additions & 0 deletions client/reducers/count-reducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const countReducer = (state = 0, action) => {
switch (action.type) {
default:
return state;
}
};

export default countReducer;
8 changes: 8 additions & 0 deletions client/reducers/data-reducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const dataReducer = (state = {}, action) => {
switch (action.type) {
default:
return state;
}
};

export default dataReducer;
10 changes: 10 additions & 0 deletions client/reducers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { combineReducers } from "redux";
import dataReducer from "./data-reducer";
import countReducer from "./count-reducer";

const rootReducer = combineReducers({
data: dataReducer,
count: countReducer
});

export default rootReducer;

0 comments on commit 54aa40f

Please sign in to comment.