Skip to content

Commit

Permalink
bug fix for multiple nav bars
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraju-pc committed Aug 9, 2023
1 parent 977aede commit 2e69d32
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Week-16-React_Router_and_React_Bootstrap/src/pages/Home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ import Button from 'react-bootstrap/Button';
import Image from 'react-bootstrap/Image';
import { Link, useNavigate } from 'react-router-dom';
import NavBar from "../../components/NavBar";
import { useUserContext } from "../../components/UserContext";
import { useEffect } from "react";

//Home Page
export default function Home(){

//Setup Context
const { user, logout } = useUserContext();

//Setup Navigate
const navigate = useNavigate();

Expand All @@ -19,6 +24,17 @@ function goLogin(){
navigate(`/Login`);
};

//Log Out Button Function
const handleLogout = () => {
logout();

};

//Useeffect to log out of context on loadin
useEffect(()=> {
handleLogout()
}, [])

//Html Output
return(
<>
Expand Down

0 comments on commit 2e69d32

Please sign in to comment.