작성
·
239
0
login이나 register나 페이지에 들어가면 아무것도 안 뜨네요...
==App.js==
//import React from 'react';
import {
BrowserRouter as Router,
Routes,
Route
} from "react-router-dom";
import LandingPage from './components/views/LandingPage/LandingPage.js'
import LoginPage from './components/views/LoginPage/LoginPage.js'
import Registerpage from './components/views/RegisterPage/RegisterPage.js'
function App() {
return (
<Router>
<div>
<Routes>
<Route exact path="/" component={LandingPage} />
<Route exact path="/login" component={LoginPage} />
<Route exact path="/register" component={Registerpage} />
</Routes>
</div>
</Router>
);
}
export default App;
==LandingPage.js
import React,{ useEffect} from 'react'
import axios from 'axios';
function LandingPage() {
useEffect(() => {
axios.get('/api/hello')
.then(response => console.log(response.data))
}, [])
return (
<div>
<h3>LandingPage 랜딩페이지</h3>
</div>
)
}
export default LandingPage
==LoginPage==
import React from 'react'
function LoginPage() {
return (
<div>
LoginPage
</div>
)
}
export default LoginPage
답변 2
1
혹시 도움이 될지는 모르겠지만
저도 같은 문제로 헤맸었는데 한 번 이렇게 해보세요
저는 이렇게 코드 바꿨더니 잘 나오더라구요
0