{"library":"react-router-dom","title":"React Router DOM","description":"React Router DOM (version 7.14.1) provides declarative routing for React web applications. It currently serves as a compatibility layer for projects migrating from React Router v6 to v7, re-exporting all components and hooks from the `react-router` package. While actively maintained with frequent minor and patch releases, its primary purpose is to facilitate migration, and users are encouraged to eventually remove it and import directly from `react-router` in v7 projects.","language":"javascript","status":"deprecated","last_verified":"Sat Apr 18","install":{"commands":["npm install react-router-dom"],"cli":null},"imports":["import { BrowserRouter } from 'react-router-dom'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { BrowserRouter, Routes, Route, Link } from 'react-router-dom';\n\nfunction App() {\n  return (\n    <div>\n      <nav>\n        <Link to=\"/\">Home</Link> | <Link to=\"/about\">About</Link>\n      </nav>\n      <Routes>\n        <Route path=\"/\" element={<Home />} />\n        <Route path=\"/about\" element={<About />} />\n        <Route path=\"*\" element={<NoMatch />} />\n      </Routes>\n    </div>\n  );\n}\n\nfunction Home() {\n  return <h2>Home</h2>;\n}\n\nfunction About() {\n  return <h2>About</h2>;\n}\n\nfunction NoMatch() {\n  return <h3>Nothing to see here!</h3>;\n}\n\nconst root = ReactDOM.createRoot(document.getElementById('root')!);\nroot.render(\n  <React.StrictMode>\n    <App />\n  </React.StrictMode>\n);","lang":"typescript","description":"This example demonstrates a basic React application using `BrowserRouter` to set up client-side routing, defining different paths with `Routes` and `Route` components, and navigating between them with `Link`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}