The BrowserRouter
component is a router component that uses the HTML5 history API (pushState
, replaceState
, and the popstate
event) to keep your UI in sync with the URL. This means that the BrowserRouter history library helps React Router keep track of the browsing history of the application using the browser’s built-in history stack. The Routes
component is wrapped inside the BrowserRouter
component.
import { BrowserRouter } from 'react-router-dom'
function App(){
return(
<BrowserRouter>
<Routes>
// define routes path and its components
</Routes>
</BrowserRouter>
);
}
export default App;