Skip to content

Instantly share code, notes, and snippets.

@KendrickIW
Created March 27, 2019 21:24
Show Gist options
  • Save KendrickIW/4d242b8b15169da95bf510b0eaae2af2 to your computer and use it in GitHub Desktop.
Save KendrickIW/4d242b8b15169da95bf510b0eaae2af2 to your computer and use it in GitHub Desktop.
Proposal for writing containers
import { connect } from 'react-redux'
// Dont import the component
const mapStateToProps = (state) => {
....
}
const mapDispatchToProps = (dispatch) => {
....
}
export default connect(mapStateToProps, mapDispatchToProps)
import React, { Component } from 'react'
class FormUI extends Component {
....
}
export default FormUI
import FormUI from './FormUI'
import container from './container'
export default container(FormUI) // Combine component with container here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment