Update Header component to use localStorage for username

This commit is contained in:
Davenludd 2024-03-18 10:28:05 +01:00
parent 7a6b875aeb
commit f6b2d17b97

View file

@ -1,7 +1,7 @@
import { useState } from "react";
import { Link } from "react-router-dom";
function Header({ username }: { username: string }): JSX.Element {
function Header(): JSX.Element {
const [isOpen, setIsOpen] = useState(false);
const handleLogout = (): void => {
@ -31,7 +31,7 @@ function Header({ username }: { username: string }): JSX.Element {
}}
>
<button className="mr-4 underline font-bold text-white">
{username}
{localStorage.getItem("username")}
</button>
{isOpen && (