yasnippet-snippets/snippets/rjsx-mode/Redux/hocredux

29 lines
694 B
Plaintext

# -*- mode: snippet -*-
# uuid: 68de6229-17f5-4bd6-83ef-feaa3a1ccb31
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
# name: hocComponentWithRedux
# key: hocredux
# --
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
export const ${1:hocComponentName} = (WrappedComponent) => {
const hocComponent = (props) => <WrappedComponent {...props} />
hocComponent.propTypes = {
}
return hocComponent
}
const mapStateToProps = (state, ownProps) => ({
})
const mapDispatchToProps = (dispatch, ownProps) => ({
})
export default WrapperComponent => connect(mapStateToProps, mapDispatchToProps)(${1:hocComponentName}(WrapperComponent))