Skip to main content

useIsEmail

Definition

  • useIsEmail is a hook which return true if the value that give match email regex pattern.

Usage Example

import { useIsEmail } from '@utiliser/react-hooks'

const App = () => {
const [email, setEmail] = useState<string>('')
const { isEmail, checkIfEmail } = useIsEmail(email)

return (
<div>
<input
type="text"
value={email}
onChange={(e) => setEmail(e.target.value)}
onKeyDown={checkIfEmail}
/>
</div>
)
}

export default App