How to Download and Install React Router (Step by Step)
Every way to get React Router running: one npm command, a new Framework Mode app, or an offline install from the downloaded package, with checks at each step.
Read MoreBefore adding any package to a work project, it is fair to ask: is React Router safe, is it really free, and can I trust where I got it from? The short answer is yes on all three, as long as you install it from a trustworthy source and verify what you download. This article explains the license in plain English, the safe ways to get the package, how to check a file yourself, and the security habits that matter when you write routing code.
React Router has been developed in the open since 2014. It was created by Michael Jackson and Ryan Florence, who later founded Remix Software. Shopify acquired Remix in 2022, and the Remix team at Shopify maintains React Router today. The source code, issue tracker and every change are public, and releases are published to the npm registry under the react-router package name.
That history matters for safety: a long-lived project with a large user base and public code review is far less likely to hide surprises than an unknown package with a similar name.
React Router is released under the MIT license, one of the most permissive open source licenses. In practice it means:
LICENSE.md inside the package.If your company keeps a list of approved licenses, MIT is almost always on it. React Router's own runtime dependencies are also permissively licensed, so it does not pull copyleft code into your bundle.
npm i react-router (or the pnpm, Yarn and Bun equivalents) downloads from the public npm registry and checks the file's integrity hash automatically. This is the default and the best choice for most people..tgz download is fine as long as you verify it against a published checksum. Our download page lists both the SHA-256 checksum and npm's SHA-512 integrity value for the file.Watch out for look-alike package names. Typosquatting, publishing a malicious package with a name close to a popular one, is a real attack on npm. Type the name carefully: the package is exactly react-router. Be suspicious of unfamiliar packages that promise to be "react-router but better" or a renamed fork you have never heard of.
If you downloaded react-router-8.5.3.tgz, check it before installing:
# macOS / Linux
shasum -a 256 react-router-8.5.3.tgz
# Windows PowerShell
Get-FileHash react-router-8.5.3.tgz -Algorithm SHA256
Compare the output with the SHA-256 on the download page. You can go one step further and compare against npm itself: the registry publishes a SHA-512 "integrity" value for every version. Run npm view react-router@8.5.3 dist.integrity and compare it with:
openssl dgst -sha512 -binary react-router-8.5.3.tgz | base64
The output, prefixed with sha512-, should match exactly. If it does, the file is byte-for-byte the same as the one on npm. You can also list the contents without installing anything with tar -tzf react-router-8.5.3.tgz.
package-lock.json, pnpm-lock.yaml, yarn.lock or bun.lock). It pins exact versions and their integrity hashes, so every install gets identical files.npm ci in CI. It installs exactly what the lockfile says and fails if anything differs.npm audit regularly, or turn on automated dependency alerts in your Git host, to hear about known vulnerabilities.Larger teams usually add a few guardrails on top of the basics:
npm audit signatures to verify registry signatures for everything installed.A safe package can still be used unsafely. These are the mistakes that matter most with any router:
Redirecting guests away from /admin in the browser hides the page, but anyone can still call your API directly. Always check permissions on the server: in your API, or in Framework Mode loaders, actions and middleware, which run on the server.
Anything from useParams or useSearchParams comes from the address bar, which the user controls. Validate it before using it in database queries or API calls, and never build HTML from it with dangerouslySetInnerHTML.
A login page that redirects to ?next=... from the URL can be abused to send users to a malicious site (an "open redirect"). Only allow relative paths that start with a single /.
If you use React Server Components in Framework Mode, treat every server function as a public endpoint that performs its own access checks, as the React Router docs themselves recommend.
React Router is safe to use and free for commercial work under the MIT license. Get it from your package manager or a checksum-verified download, keep your lockfile committed, update regularly, and enforce permissions on the server. Ready to install? Follow How to Download and Install React Router (Step by Step). Hit a snag? See common errors and fixes.
Get React Router 8.5.3: one npm command, or the verified package download.
DownloadRelated articles
Every way to get React Router running: one npm command, a new Framework Mode app, or an offline install from the downloaded package, with checks at each step.
Read MoreBuild a small multi-page React app from scratch and learn Routes, Link, NavLink, Outlet, useParams and useNavigate along the way.
Read MoreA plain-English tour of what React Router can do, from nested layouts and URL params to loaders, actions, type-safe routes and server rendering.
Read More