Suppose we want to enter 67.38 dollars in an amount field the following should be the way in which it should be formatted.
0.06
0.67
6.73
67.38
This is basically mocking the way we enter amount in a swiping machine.
So the foramtAmount function should fulfill the above requirement. The setAmount is used to set the amount of a react state variable
onChange={(val) => {
setPayoffAmt(formatAmount(val))
}
const foramtAmount = (val) => {
//code
}