Closed muhrifqii closed 5 months ago
You should use defaultValue
prop instead of value
. Passing value
makes it controlled and you have to update the value
using onValueChange
.
You should use
defaultValue
prop instead ofvalue
. Passingvalue
makes it controlled and you have to update thevalue
usingonValueChange
.
So there's no way to change the value programmatically?
So there's no way to change the value programmatically?
Just like any other controlled/stateful component, you need to set the value to a state and then update that value using the onValueChange
function. https://medium.com/@vitorbritto/react-design-patterns-controlled-uncontrolled-component-pattern-7335b85413a0.
@barrownicholas Yes you're right. I forgot the concept of controlled components. Thanks for the heads up
Describe the bug When value is set to the CurrencyInput, any user typing the input doesn't change the value shown on the input field
To Reproduce Steps to reproduce the behavior: Just use below code and you could see the bug
any type for the list
and the reproduce code:
Expected behavior When value is set, it should not prevent user input changes