undefined is not an object (evaluating ‘context._context’) in react-native

I was mistaken you are importing EmailContext it should be Emailcontext Your Email Verification component should look like this:

import React, {useContext, useState} from 'react';
import {Emailcontext} from '../ContextStore'

const EmailVerification = ({navigation}) => {
    const [emailAddress, setEmailAddress] = useContext(Emailcontext);
  
    return(
      **jsx element**
    );
}
export default EmailVerification;

also you have made ContextStore a default export so when importing into your app.js ensure you are importing it like so:

import ContextStore from '...correct path'

I know you are using react-native but here is a code pen of a CRA, where I wrap the index.js in the provider and do the proper imports into app.js to emulate your EmailVerification component.

https://codesandbox.io/s/admiring-shaw-5yrs3?file=/src/App.js

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top