Skip to content

Commit

Permalink
Refactor: use hallOfFame from state and use it as a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ThulinaWickramasinghe committed Aug 21, 2024
1 parent 9da0022 commit 7ea2aa9
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/components/layout/header.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useState } from "react";
import { RxCross1, RxHamburgerMenu } from "react-icons/rx";
import { Link } from "react-router-dom";
import { useLocation } from "react-router-dom";
Expand All @@ -17,14 +17,11 @@ const buttonStyles = "mt-1.5 xl:mt-0 px-8 xl:px-[1.15rem] pb-2.5 xl:pb-[0.4rem]

const Header = ({ className }) => {
const [mobileNavOpen, setMobileNavOpen] = useState(false);
const [isHallOfFame, setIsHallOfFame] = useState();

const breakpoints = useBreakpoint();
const { pathname } = useLocation();

useEffect(() => {
setIsHallOfFame(pathname === hallOfFame);
}, [pathname]);
const isHallOfFame = pathname === hallOfFame;

return (
<header
Expand Down

0 comments on commit 7ea2aa9

Please sign in to comment.