title: Uncaught TypeError: Cannot read properties of undefined (reading 'then')
body: <p>getting property undefined error on this.props.firebase.doSendEmailVerification() thus (.then) is undefined can somebody helped me fix this error.
  code has to resend email verification if the user does not able to signup during first verification mail.</p>
  <pre><code>import React from 'react';    
  import AuthUserContext from './context';
  import { withFirebase } from '../Firebase';
  
  const needsEmailVerification = authUser =&gt;
    authUser &amp;&amp;
    !authUser.emailVerified &amp;&amp;
    authUser.providerData
      .map(provider =&gt; provider.providerId)
      .includes('password');
  
  const withEmailVerification = Component =&gt; {
    class WithEmailVerification extends React.Component {
      constructor(props) {
        super(props);
  
        this.state = { isSent: false };
      }
  
      onSendEmailVerification = () =&gt; {
        this.props.firebase
          .doSendEmailVerification()
          .then(() =&gt; this.setState({ isSent: true }));
      };
  
      render() {
        return (
          &lt;AuthUserContext.Consumer&gt;
            {authUser =&gt;
              needsEmailVerification(authUser) ? (
                &lt;div&gt;
                  {this.state.isSent ? (
                    &lt;p&gt;
                      E-Mail confirmation sent: Check your E-Mails (Spam
                      folder included) for a confirmation E-Mail.
                      Refresh this page once you confirmed your E-Mail.
                    &lt;/p&gt;
                  ) : (
                    &lt;p&gt;
                      Verify your E-Mail: Check your E-Mails (Spam folder
                      included) for a confirmation E-Mail or send
                      another confirmation E-Mail.
                    &lt;/p&gt;
                  )}
  
                  &lt;button
                    type=&quot;button&quot;
                    onClick={this.onSendEmailVerification}
                    disabled={this.state.isSent}
                  &gt;
                    Send confirmation E-Mail
                  &lt;/button&gt;
                &lt;/div&gt;
              ) : (
                &lt;Component {...this.props} /&gt;
              )
            }
          &lt;/AuthUserContext.Consumer&gt;
        );
      }
    }
  
    return withFirebase(WithEmailVerification);
  };
  
  export default withEmailVerification;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/SwsaE.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p><a href="https://i.stack.imgur.com/BCwWo.png" rel="nofollow noreferrer">enter image description here</a></p>