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

import { actionCreators } from 'reduxBits/XXX'


const mapStateToProps = state => ({
  {{#each properties}}
  {{this}}: state.YYY,
  {{/each}}
  YYY: state.YYY,
})

const mapDispatchToProps = dispatch => ({
  actions: bindActionCreators(actionCreators, dispatch),
})

{{#if classComponent}}
class {{name}} extends React.Component {
  render() {
    return (
      <div>
      </div>
    )
  }
}

{{else}}
const {{name}} = ({ actions{{#each properties}}, {{this}}{{/each}} }) => (
  <div>
  </div>
)

{{/if}}
{{name}}.propTypes = {
  {{#each properties}}
  {{this}}: PropTypes.XXX,
  {{/each}}
  actions: PropTypes.objectOf(PropTypes.func).isRequired,
}

export { {{name}} as _{{name}} }
export default connect(
  mapStateToProps,
  mapDispatchToProps,
)({{name}})
