강의

멘토링

커뮤니티

Inflearn Community Q&A

jysrho125917's profile image
jysrho125917

asked

Node and React series that you can learn by following - Basic lecture

Node React Basics Lecture #20 React Router Dom

Router 예제 복붙 - 오류

Written on

·

1.1K

3

20강에서

Router 예제 복붙 시 오류안나는 최종본입니다 !!

import React from "react";
import {
  Route,
  Routes,
  BrowserRouter
} from "react-router-dom";

import LandingPage from "./components/views/LandingPage/LandingPage";
import LoginPage from "./components/views/LoginPage/LoginPage";
import RegisterPage from "./components/views/RegisterPage/RegisterPage";


function App() {
  return (
    <BrowserRouter>
      <div>
        {/* A <Switch> looks through its children <Route>s and
          renders the first one that matches the current URL. */}
        <Routes>
          <Route exact path="/" element={LandingPage()}/>
           
          <Route exact path="/login" element={LoginPage()}/>
          
          <Route exact path="/register" element={RegisterPage()}/>
          
        </Routes>
      </div>
    </BrowserRouter>
  );
}

export default App;

 

nodejsreact

Answer 2

1

<BrowserRouter> 대신 <Router>를 써야 서버 시작시 에러가 안뜨더라구요. 그래도 감사합니다.

0

redux나 contextAPI를 사용해도 이렇게 했을 때 정상동작이 되던가요??

 

jysrho125917's profile image
jysrho125917

asked

Ask a question