Skip to content

Commit

Permalink
added activebook reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Jan 1, 2016
1 parent b0dee24 commit 386754e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion book_list/src/reducers/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { combineReducers } from 'redux';
import BooksReducer from './reducer_books';
import ActiveBook from './reducer_active_book';

const rootReducer = combineReducers({
books: BooksReducer
books: BooksReducer,
activeBook: ActiveBook
});

export default rootReducer;
10 changes: 10 additions & 0 deletions book_list/src/reducers/reducer_active_book.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// State argument is not application state, only the state
// this reducer is responsible for
export default function(state = null, action) {
switch(action.type) {
case 'BOOK_SELECTED':
return action.payload;
}

return state;
}

0 comments on commit 386754e

Please sign in to comment.