1
votes

How to make float input in react final form? I do like this:

parse={value =>{!parseFloat(value) || !Number(value) || value.endsWith(".") ? value : parseFloat(value);}}

But I can type letters and when I put 1. it`s string, but I need float

1

1 Answers

3
votes

The best practice, in my experience, is to leave it as a string in your form values and

  • use client-side validation to confirm that it's a valid Number
  • convert to a Number on submit