Last active
July 20, 2016 15:28
-
-
Save timbuckley/ffe6a2521408c3954b2f1820b1d22e7c to your computer and use it in GitHub Desktop.
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 React, { Component } from 'react' | |
import { bindActionCreators } from 'redux' | |
import { connect } from 'react-redux' | |
import Settings from '../components/scenes/settings' | |
import * as settingActions from '../actions/settings' | |
import * as signUpActions from '../actions/sign-up' | |
import * as loginActions from '../actions/login' | |
import * as routerActions from '../actions/router' | |
class SettingsContainer extends Component { | |
static propTypes = { | |
state: React.PropTypes.object.isRequired, | |
actions: React.PropTypes.object.isRequired | |
} | |
render() { | |
const { state, actions } = this.props | |
return ( | |
<Settings | |
state={{...state}} | |
actions={{...actions}} | |
/> | |
) | |
} | |
} | |
// map global state to component properties | |
function mapStateToProps(state) { | |
return {state: state} | |
} | |
// map global state to component properties | |
function mapDispatchToProps(dispatch) { | |
const allActions = { | |
...loginActions, | |
...settingActions, | |
...signUpActions, | |
...routerActions | |
} | |
return { | |
actions: bindActionCreators(allActions, dispatch) | |
} | |
} | |
export default connect(mapStateToProps, mapDispatchToProps)(SettingsContainer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment