Check out example codes for "html5 input required length". It will help you in understanding the concepts better.

Code Example 1

<input pattern=".{3,}"   required title="3 characters minimum">
<input pattern=".{5,10}" required title="5 to 10 characters">

Learn ReactJs, React Native from akashmittal.com