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

29 lines
694 B
Plaintext
Raw Normal View History

2019-02-28 21:03:22 +01:00
# -*- 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) => {
2019-12-25 14:46:48 +01:00
const hocComponent = (props) => <WrappedComponent {...props} />
2019-02-28 21:03:22 +01:00
hocComponent.propTypes = {
}
return hocComponent
}
2019-12-25 14:46:48 +01:00
const mapStateToProps = (state, ownProps) => ({
})
const mapDispatchToProps = (dispatch, ownProps) => ({
})
2019-02-28 21:36:05 +01:00
export default WrapperComponent => connect(mapStateToProps, mapDispatchToProps)(${1:hocComponentName}(WrapperComponent))