I need to format my input value to use a mask for BRL currency
Here is my input
<InputAnimation
required
type={"number"}
placeholder={" "}
label={"Valor"}
onChange={event=>setValue(event.target.valueAsNumber)}
value={value}
/>
I tried many tutorials, however most shows how to do it in jQuery or JS, and that doesn’t work well for React+Typescript
2
Answers
Here is the way I used to fix this:
And the function:
So there is no need of additional component or lib.
To format your input value to use a mask for BRL currency in React with Typescript, you can use a package like
react-number-format
orreact-currency-format
. Here’s an example of how you can usereact-number-format
.