1. index.js 에서는 App으로 BrouserRouter만 선언해주기
import App from './App'
import { BrowserRouter } from 'react-router-dom'
const root = ReactDOM.createRoot(document.getElementById('root'))
root.render(
<React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>
)
2. App.js 에서 Router들 선언해주기
function App() {
return (
<>
<Heading />
<Routes>
<Route path="/Upload" element={<Upload />} />
<Route path="/List" element={<List />} />
</Routes>
</>
)
}