[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]
