๐ฉ๐ป๊ฐ๋ฐ_TIL/TIL
[๋ฆฌ์กํธ]๋ฆฌ์กํธ ๋ผ์ฐํฐ ์ด๊ธฐ ์ธํ ์ ํด๋ณด์!
Daisy.lee
2021. 12. 25. 21:03
1. ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น
yarn add react-router-dom ๋๋ npm install react-router-dom
(์ต์ ๋ฒ์ ๋ณด๋ค ๋ค์ด๊ทธ๋ ์ด๋๋ ๋ฒ์ ์ ์ฌ์ฉํ๊ณ ์ถ์ ๊ฒฝ์ฐ: react-router-dom@5(5๋ฒ์ )๊ณผ ๊ฐ์ด ์ ๋ ฅํฉ๋๋ค.
2. importํ๊ธฐ
3. App ๊ฐ์ธ๊ธฐ
import์ App ๊ฐ์ธ๊ธฐ๋ index.js ํ์ผ์์ ํ ๋ฒ์ ํ๋ฉด ๋ฉ๋๋ค.
react-router-dom์ด๋ผ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ค์นํ๊ณ ๊ฑฐ์ณ์ผ ํ ๋จ๊ณ๋ฅผ ์ ๋ฆฌํ๊ณ , ๋์ค์ ๋ค๋ฅธ ํ๋ก์ ํธ์ ์ ์ฉํ ๋ ๋์ฐ ์ฝ๊ฒ ์ฐพ์ ์ ์๋๋ก ์ผ์ต๋๋ค.๐ happy hacking ํ์ธ์!