Skip to content

Commit

Permalink
fix: add necessary dependencies of hooks (#906)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmoai committed Aug 4, 2020
1 parent b77046f commit a14e2c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Input/CurrencyInput/CurrencyInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export const CurrencyInput = forwardRef<HTMLInputElement, Props>(
if (props.value === undefined && props.defaultValue !== undefined) {
formatValue(formatCurrency(props.defaultValue))
}
// when component did mount
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

useEffect(() => {
Expand All @@ -53,7 +55,7 @@ export const CurrencyInput = forwardRef<HTMLInputElement, Props>(
formatValue(formatCurrency(innerRef.current.value))
}
}
}, [isFocused])
}, [isFocused, props.value, formatValue])

const handleFocus = (e: FocusEvent<HTMLInputElement>) => {
setIsFocused(true)
Expand Down

0 comments on commit a14e2c0

Please sign in to comment.