forked from dvdzkwsk/react-redux-starter-kit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chenyi LEE
committed
Dec 1, 2016
1 parent
b9cb674
commit 8f50a3b
Showing
5 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react' | ||
|
||
export const Todo = (props) => ( | ||
<div style={{ margin: '0 auto' }} > | ||
<h2>Todo</h2> | ||
</div> | ||
) | ||
|
||
Todo.propTypes = { | ||
} | ||
|
||
export default Todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { connect } from 'react-redux' | ||
|
||
import Todo from '../components/Todo' | ||
|
||
const mapDispatchToProps = { | ||
} | ||
|
||
const mapStateToProps = (state) => ({ | ||
}) | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(Todo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { injectReducer } from '../../store/reducers' | ||
|
||
export default (store) => ({ | ||
path : 'todo', | ||
getComponent (nextState, cb) { | ||
require.ensure([], (require) => { | ||
const Todo = require('./containers/TodoContainer').default | ||
const reducer = require('./modules/todo').default | ||
|
||
injectReducer(store, { key: 'todo', reducer }) | ||
|
||
cb(null, Todo) | ||
|
||
}, 'todo') | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// ------------------------------------ | ||
// Constants | ||
// ------------------------------------ | ||
|
||
// ------------------------------------ | ||
// Actions | ||
// ------------------------------------ | ||
|
||
// ------------------------------------ | ||
// Action Handlers | ||
// ------------------------------------ | ||
const ACTION_HANDLERS = { | ||
} | ||
|
||
// ------------------------------------ | ||
// Reducer | ||
// ------------------------------------ | ||
const initialState = {} | ||
export default function todoReducer (state = initialState, action) { | ||
const handler = ACTION_HANDLERS[action.type] | ||
|
||
return handler ? handler(state, action) : state | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters