Force number input to have two decimal places and always show two decimals in React

I want to have an input field that always limits input to two decimal places but also displays two decimal places,

I know this is a follow on to this question:

Force number input to have two decimal places and ONLY two

But when I implement this in React, it doesn't format to 2 decimal places, if say the number is 3. It is as if it is ignoring the step prop.


Solution 1:

I wrote a working example for chrome here:

https://codesandbox.io/s/xo2x1qnw0w

For Firefox the .toFixed() method is not properly working as it cuts off the non-significant zeroes. It does work however for numbers like 42.98763