use-mask
v0.1.0
Published
A string formatter and validator based on masks
Downloads
2
Maintainers
Readme
use mask
Example
import useMask from 'use-mask'
function PhoneInput() {
const [phone, setPhone, validPhone] = useMask('(00) 0000-0000')
return (
<>
<p>{validPhone ? 'Valid' : 'Invalid'}</p>
<input
type="tel"
value={phone}
onChange={e => setPhone(e.target.value)}
/>
</>
)
}