Add withModalProps HOC

feature/default_network_editable
Alexander Tseung 6 years ago
parent 04ec3f0b6b
commit 3e470fee8a
  1. 1
      ui/app/higher-order-components/with-modal-props/index.js
  2. 21
      ui/app/higher-order-components/with-modal-props/with-modal-props.js

@ -0,0 +1 @@
export { default } from './with-modal-props'

@ -0,0 +1,21 @@
import { connect } from 'react-redux'
import { hideModal } from '../../actions'
const mapStateToProps = state => {
const { appState } = state
const { props: modalProps } = appState.modal.modalState
return {
...modalProps,
}
}
const mapDispatchToProps = dispatch => {
return {
hideModal: () => dispatch(hideModal()),
}
}
export default function withModalProps (Component) {
return connect(mapStateToProps, mapDispatchToProps)(Component)
}
Loading…
Cancel
Save