shaminmeerankutty
7/18/2018 - 11:34 AM

Redux Class Boilerplate with Proptypes

Redux Class Boilerplate with Proptypes

import React from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'

class ClassName extends React.Component {
  constructor(props) {
    super(props)
  }
  render() {
    return ()
  }
}
const mapStateToProps = state => ({
  variable: state.variable
})

const mapDispatchToProps = dispatch => ({
  function: (variable) => {
    dispatch(function(variable))
  }
})

ClassName.propTypes = {
  variable: PropTypes.shape({
    variable: PropTypes.array
  }).isRequired,
  setLoading: PropTypes.func.isRequired
}
    
export default connect(mapStateToProps, mapDispatchToProps)(ClassName)