'Only postive integers in input field in react

I have a input field for price and quantity and I want to restrict it to have only +ve integers. I don't want to do any kind of validation like the type=number does half the work, but it still doesn't prevent the input from taking any -ve values or like +, -, e. I don't want to use any 3rd party libraries or need to do any kind of validation or show any error, if the person types in the -ve values or anything then these symbols just should be blocked. Any idea how to do this?



Solution 1:[1]

Use the min attribute, for example:

<input type="number" min={0} />

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mymoto