mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add withModalProps HOC
This commit is contained in:
parent
04ec3f0b6b
commit
3e470fee8a
1
ui/app/higher-order-components/with-modal-props/index.js
Normal file
1
ui/app/higher-order-components/with-modal-props/index.js
Normal file
@ -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…
Reference in New Issue
Block a user