Skip to content

qualitybath/use-mailcheck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Use-Mailcheck

React component for the mailcheck library. Reduce user-misspelled email addresses in your forms by suggesting a right domain when your users misspell it in an email address.

Installation

yarn add @qb/use-mailcheck

Usage

import useMailCheck from '@qb/use-mailcheck';

const [inputText, setInputText] = useState(null);
const suggestion = useMailCheck({ email: inputText });

<div>
  <input
    type="email"
    value={inputText}
    onChange={e => {
      setInputText(e.target.value);
    }}
  />
  {suggestion && <div>Did you mean {suggestion.full}?</div>}
</div>;
  • suggestion: The suggestion object passed back to you, or null if mailcheck has nothing to suggest. The suggestion object has the following members:
{
  address: 'test',        // the address; part before the @ sign
  domain: 'gmail.com',    // the suggested domain
  full: '[email protected]'  // the full suggested email
}

Thanks

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published