Check out example codes for "minmax length password". It will help you in understanding the concepts better.

Code Example 1

<label for="password">Password:</label>
<input id="password" type="password" pattern=".{5,10}" required title="5 to 10 characters">

Learn ReactJs, React Native from akashmittal.com