import React from "react";
import { getAuth, signOut } from "firebase/auth";
import { useNavigate } from "react-router-dom";
const Profile = () => {
const auth = getAuth();
const navigate = useNavigate();
const onLogOutClick = () => {
signOut(auth);
navigate("/");
};
return (
<>
<button onClick={onLogOutClick}>Log Out</button>
</>
);
};
export default Profile;
https://firebase.google.com/docs/auth/web/password-auth?hl=ko
singOut 함수를 사용한다.
간단히 useNavigate로 '/'에 이동시킨다.
안그러면 로그아웃 상태로 profile uri에 남아있음