Monday, November 9, 2026
HomeiOS Developmentjavascript - React-Native TypeError: undefined isn't an object (evaluating '_useContext.person') FireBase

javascript – React-Native TypeError: undefined isn’t an object (evaluating ‘_useContext.person’) FireBase

[ad_1]

import React, {createContext, useState} from 'react';
import auth from '@react-native-firebase/auth';


export const AuthContext = createContext();

export const AuthProvider = ({youngsters}) => {
  const [user, setUser] = useState(null);

  return (
    <AuthContext.Supplier
      worth={{
        person,
        setUser,
        login: async (e mail, password) => {
          attempt {
            await auth().signInWithEmailAndPassword(e mail, password);
          } catch (e) {
            console.log(e);
          }
        },
        register: async (e mail, password) => {
          attempt {
            await auth().createUserWithEmailAndPassword(e mail, password)
          } catch (e) {
            console.log(e);
          }
        },
        logout: async () => {
          attempt {
            await auth().signOut();
          } catch (e) {
            console.log(e);
          }
        },
      }}>
      {youngsters}
    </AuthContext.Supplier>
  );
};

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments