헤더 컴포넌트에서 user 값이 주어질 경우 계정명과 로그아웃 버튼을 보여 주도록 수정하세요.
components/common/Header.js
import React from 'react'; import styled from 'styled-components'; import Responsive from './Responsive'; import Button from './Button'; import { Link } from 'react-router-dom'; (...) const UserInfo = styled.div` font-weight: 800; margin-right: 1rem; `; const Header = ({ user }) => { return ( <> <HeaderBlock> <Wrapper> <Link to="/" className="logo"> REACTERS </Link> {user ? ( <div className="right"> <UserInfo>{user.username}</UserInfo> <Button>로그아웃</Button> </div> ) : ( <div className="right"> <Button to="/login">로그인</Button> </div> )} </Wrapper> </HeaderBlock> <Spacer /> </> ); }; export default Header;