Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Last active March 20, 2016 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/040c974d245d264068a5 to your computer and use it in GitHub Desktop.
Save chuck0523/040c974d245d264068a5 to your computer and use it in GitHub Desktop.
import { connect } from 'react-redux'
import { prevPage, nextPage } from '../actions'
import Slide from '../components/Slide'
const getCurrentPage = (currentPage = 0) => {
return currentPage
}
const mapStateToProps = (state) => {
return {
currentPage: getCurrentPage(state.slide)
}
}
const mapDispatchToProps = (dispatch) => {
return {
onPrevClick: (currentPage) => {
// console.log(currentPage)
dispatch(prevPage(currentPage))
},
onNextClick: (currentPage)=> {
dispatch(nextPage(currentPage))
}
}
}
const SwipePage = connect(
mapStateToProps,
mapDispatchToProps
)(Slide)
export default SwipePage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment