๐ŸŒCoding/๐ŸŒŸReact

[React] React Router Dom

๋ฟŒ์•ผ._. 2022. 1. 20. 21:36

โ“ React Router Dom

 

- ํŽ˜์ด์ง€ ๊ฐ„์˜ ์ด๋™์„ ์œ„ํ•ด ์‚ฌ์šฉ

 

 

โ“ SETUP

 

npm install react-router-dom --save

 

 

โ“ import

 

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

 

 

โ“ code

 

  <Router>
      <div>
        <Routes>
          <Route exact path="/" element={<LandingPage/>}/>
          <Route exact path="/๋ธ”๋ผ๋ธ”๋ผ" element={<๋ธ”๋ผ๋ธ”๋ผPage/>}/>
        </Routes>
      </div>
  </Router>

* ์‹คํ–‰ ํ›„ ํ™”๋ฉด์— ์•„๋ฌด๊ฒƒ๋„ ๋‚˜ํƒ€๋‚˜์ง€ ์•Š์•„ ํ•œ์ฐธ ์ฐพ์•„ ํ•ด๊ฒฐํ•œ ๋ฐฉ๋ฒ•: ์ด๋™ํ•˜๋Š” ํŽ˜์ด์ง€์— </>๋ฅผ ์”Œ์›Œ์ฃผ์ž

 

 

'๐ŸŒCoding > ๐ŸŒŸReact' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[React] concurrently  (0) 2022.01.20
[React] create-react-app  (0) 2022.01.18
#6 ROUTING BONUS  (0) 2021.02.02
#4 MAKING THE MOVIE APP  (0) 2021.01.29
#3 STATE  (0) 2021.01.26