최은석

load menu list in menu page

1 import './App.css'; 1 import './App.css';
2 import axios from "axios"; 2 import axios from "axios";
3 +import { useEffect } from 'react';
3 4
4 function MenuPage() { 5 function MenuPage() {
6 +
7 + const getMenuList = () => {
8 + axios.get("/api/menuList").then((res) => {
9 + console.log(res.data);
10 + });
11 + }
12 +
13 + useEffect(()=>{
14 + getMenuList();
15 + }, []);
16 +
5 return ( 17 return (
6 <div> 18 <div>
7 메뉴 페이지 19 메뉴 페이지
......
...@@ -15,23 +15,21 @@ import { ...@@ -15,23 +15,21 @@ import {
15 15
16 const root = ReactDOM.createRoot(document.getElementById('root')); 16 const root = ReactDOM.createRoot(document.getElementById('root'));
17 root.render( 17 root.render(
18 - <React.StrictMode> 18 + <div className='Screen' style={{ borderColor: 'blue', width: '100vw', height: '100vh' }}>
19 - <div className='Screen' style={{ borderColor: 'blue', width: '100vw', height: '100vh' }}> 19 + <TopBanner />
20 - <TopBanner />
21 20
22 - <SideChat /> 21 + <SideChat />
23 - <div className='bodyContent' style={{ width: '100%', height: '100%' }}> 22 + <div className='bodyContent' style={{ width: '100%', height: '100%' }}>
24 - <Router> 23 + <Router>
25 - <Routes> 24 + <Routes>
26 - <Route path="/" element={<MainPage/>}/> 25 + <Route path="/" element={<MainPage />} />
27 - <Route path="/menu" element={<MenuPage/>}/> 26 + <Route path="/menu" element={<MenuPage />} />
28 - </Routes> 27 + </Routes>
29 - </Router> 28 + </Router>
30 - </div> 29 + </div>
31 30
32 31
33 - </div> 32 + </div>
34 - </React.StrictMode>
35 ); 33 );
36 34
37 reportWebVitals(); 35 reportWebVitals();
......