diff options
redid tx-view and balance-component mapStateToProps logic
Diffstat (limited to 'ui/app/components/balance-component.js')
-rw-r--r-- | ui/app/components/balance-component.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ui/app/components/balance-component.js b/ui/app/components/balance-component.js index 250bb6479..48efc7b6a 100644 --- a/ui/app/components/balance-component.js +++ b/ui/app/components/balance-component.js @@ -1,10 +1,18 @@ const Component = require('react').Component +const connect = require('react-redux').connect const h = require('react-hyperscript') const inherits = require('util').inherits const { formatBalance, generateBalanceObject } = require('../util') -module.exports = BalanceComponent +module.exports = connect(mapStateToProps)(BalanceComponent) + +function mapStateToProps (state) { + return { + conversionRate: state.metamask.conversionRate, + currentCurrency: state.metamask.currentCurrency, + } +} inherits(BalanceComponent, Component) function BalanceComponent () { @@ -53,8 +61,7 @@ BalanceComponent.prototype.renderBalance = function (formattedBalance) { BalanceComponent.prototype.renderFiatValue = function (formattedBalance) { - const props = this.props - const { conversionRate, currentCurrency } = props + const { conversionRate, currentCurrency } = this.props const fiatDisplayNumber = this.getFiatDisplayNumber(formattedBalance, conversionRate) |