import React, { useState, useEffect } from 'react' import { Navbar, Nav, Button } from 'react-bootstrap'; import { Link } from 'react-router-dom'; import { handleLogout } from '../utils/auth'; import axios from 'axios' function Menu() { const [username, setUsername] = useState('') async function getLoginedUser() { //email로 db에서 찾아오기 ㅇㅇㅇㅇㅇ const userid = localStorage.getItem('user') const response = await axios.post(`/users/${userid}`, { 'email': userid }) setUsername(response.data.username) } useEffect(() => { getLoginedUser() }, []) return ( YDK Messenger
{username} 님 환영합니다
) } export default Menu