Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
refactor: use field state rather than form state
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Oct 24, 2020
1 parent 57e764f commit 2c0aa0b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions renderer/components/Form/TransactionFeeInput.js
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { FormattedMessage } from 'react-intl'
import { Box, Flex } from 'rebass/styled-components'
import { withFormApi } from 'informed'
import { useFieldState } from 'informed'
import { CoinBig } from '@zap/utils/coin'
import { Spinner, Text } from 'components/UI'
import CryptoValue from 'containers/UI/CryptoValue'
Expand Down Expand Up @@ -47,11 +47,11 @@ const TransactionFeeInput = ({
initialValue = TRANSACTION_SPEED_SLOW,
label,
field,
formApi,
fee,
}) => {
const value = formApi.getValue(field)
const { value } = useFieldState(field)
const isFeeKnown = CoinBig(fee).isFinite()

return (
<Flex alignItems="center" justifyContent="space-between">
<Box>
Expand Down Expand Up @@ -128,7 +128,6 @@ TransactionSpeedDesc.propTypes = {
TransactionFeeInput.propTypes = {
fee: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
field: PropTypes.string.isRequired,
formApi: PropTypes.object.isRequired,
hasFee: PropTypes.bool,
initialValue: PropTypes.string,
isQueryingFees: PropTypes.bool,
Expand All @@ -140,4 +139,4 @@ TransactionFeeInput.propTypes = {
}).isRequired,
}

export default withFormApi(TransactionFeeInput)
export default TransactionFeeInput

0 comments on commit 2c0aa0b

Please sign in to comment.