Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
678 B

5 years ago
  1. # -*- mode: snippet -*-
  2. # uuid: 68de6229-17f5-4bd6-83ef-feaa3a1ccb31
  3. # contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
  4. # name: hocComponentWithRedux
  5. # key: hocredux
  6. # --
  7. import React from 'react'
  8. import PropTypes from 'prop-types'
  9. import { connect } from 'react-redux'
  10. export const mapStateToProps = state => ({
  11. })
  12. export const mapDispatchToProps = {
  13. }
  14. export const ${1:hocComponentName} = (WrappedComponent) => {
  15. const hocComponent = ({ ...props }) => <WrappedComponent {...props} />
  16. hocComponent.propTypes = {
  17. }
  18. return hocComponent
  19. }
  20. export default WrapperComponent => connect(mapStateToProps, mapDispatchToProps)(${1:hocComponentName}(WrapperComponent))