use-mailcheck
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

React-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 react-mailcheck

Usage

import useMailCheck from 'react-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: 'test@gmail.com'  // the full suggested email
}

Thanks

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i use-mailcheck

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

12.7 kB

Total Files

10

Last publish

Collaborators

  • michaltk