template-ivan
Version:
27 lines (21 loc) • 579 B
JavaScript
// @flow
import { connect } from 'react-redux'
import Welcome from '../components/welcome'
import getData, { requestData } from '../actions/welcome'
import type { Dispatch } from '../actions/index'
import type { State } from '../reducers/index'
function mapStateToProps(state: State) {
return {
text: state.welcome,
}
}
function mapDispatchToProps(dispatch: Dispatch) {
return {
handleClick(e) {
e.stopPropagation()
dispatch(getData())
dispatch(requestData())
},
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Welcome)