Last active
November 24, 2017 23:26
-
-
Save jide/6b5514ddd737255055e382d3da531c45 to your computer and use it in GitHub Desktop.
Unoptimized redux connectors.
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
import { createStore, combineReducers } from 'redux'; | |
import { userReducer, todosReducer, settingsReducer } from './reducers'; | |
const reducers = { | |
user: userReducer, | |
todos: todosReducer | |
}; | |
const store = createStore(combineReducers(reducers)); | |
export default store; |
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
import { connect } from 'react-redux'; | |
import { addTodo } from '../reducers/todo'; | |
import AddTodo from '../components/AddTodo'; | |
const Container = connect( | |
state => ({ | |
todos: state.todos.all | |
}), | |
{ addTodo } | |
)(AddTodo); | |
export default Container; |
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
import { connect } from 'react-redux'; | |
import { removeUser } from '../reducers/user'; | |
import Users from '../components/Users'; | |
const Container = connect( | |
state => ({ | |
users: state.users.all | |
}), | |
{ removeUser } | |
)(Users); | |
export default Container; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment