From 71187d43be8b67115dc1ac1587e5ffc9d445365c Mon Sep 17 00:00:00 2001 From: Om Londhe <61611599+omlondhe@users.noreply.github.com> Date: Sun, 7 May 2023 17:06:35 +0530 Subject: [PATCH] fix: removed unnecessary useState (#6580) * Removed unnecessary useState * Update search.js Removed `_` as per my conversation with **Sir Eddie Jaoude**. --- components/navbar/Navbar.js | 17 ++++++++--------- pages/events.js | 8 +++----- pages/search.js | 4 ++-- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/components/navbar/Navbar.js b/components/navbar/Navbar.js index 2373fe1ca19..46786b443ec 100644 --- a/components/navbar/Navbar.js +++ b/components/navbar/Navbar.js @@ -14,20 +14,19 @@ const FaRegMoon = getIcon("FaRegMoon"); const FaSun = getIcon("FaSun"); export default function Navbar() { - const { systemTheme, theme, setTheme } = useTheme(); + const [isOpen, setIsOpen] = useState(false); const [mounted, setMounted] = useState(false); + const router = useRouter(); + const navConRef = useRef(); + const { data: session } = useSession(); + const { systemTheme, theme, setTheme } = useTheme(); + const getLink = (path) => `${router.basePath}${path}`; + useEffect(() => { setMounted(true); }, []); - const { data: session } = useSession(); - const [isOpen, setIsOpen] = useState(false); - - const router = useRouter(); - const getLink = (path) => `${router.basePath}${path}`; - const navConRef = useRef(); - const renderThemeChanger = () => { if (!mounted) { return null; @@ -38,7 +37,7 @@ export default function Navbar() { if (currentTheme === "dark") { return (