Check out example codes for "input number max". It will help you in understanding the concepts better.

Code Example 1

<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5"><br><br>

Code Example 2

<input type="text" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');" />

Learn ReactJs, React Native from akashmittal.com