TypeScript says your Router is missing location and navigator
Type '{ children: Element[]; }' is missing the following properties from type 'RouterProps': location, navigatorShort answer
You rendered the low-level Router component, which requires you to pass location and navigator yourself. React Router's docs say you almost never render it directly. Use BrowserRouter for a browser app (MemoryRouter or StaticRouter elsewhere) and let it create those props for you.
Fix it fast
1Find out which cause you have
Look at what your root file imports and renders. The error means the component named Router is the low-level one.
grep -rn -E "import .*Router|<Router" src/2Match what you see, then jump to its fix
What does the error look like?
Type '{ children: Element[]; }' is missing the following properties from type 'RouterProps': location, navigator
Cause 1 of 2
Router was imported where BrowserRouter was meant
1Check
Router is the shared low-level interface of all router components, and its props type makes location and navigator required.
grep -rn "<Router" src/2Fix
Swap it for the higher-level router that matches your environment. In a browser app that is BrowserRouter, which needs no location or navigator.
import { BrowserRouter } from "react-router-dom";
root.render(
<BrowserRouter>
<App />
</BrowserRouter>
);3Verify
Run the type check.
npx tsc --noEmitConfirmed by reactrouter.com
Cause 2 of 2
You really need Router, so both props must be supplied
1Check
RouterProps declares location (a Location-like object or a string) and navigator as required. Without them the compiler cannot accept the element.
grep -rn -B2 -A6 "<Router" src/2Fix
Pass both. Remember that one router is enough for an app; do not nest routers.
<Router location={location} navigator={navigator}>
<App />
</Router>3Verify
Run the type check and open the app.
npx tsc --noEmitConfirmed by reactrouter.com
How do I stop it coming back?
- Let your editor import BrowserRouter from the router package, not Router.
- Keep a single router at the root of the app.
- Run tsc in CI so type errors in the router setup fail the build.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
TypeScript refuses JSX because the jsx option is not set
TS17004: Cannot use JSX unless the '--jsx' flag is provided.
TypeScript compiles JSX only when you name the file with a .tsx extension and enable the jsx compiler option.
2 causes, each with a fixWeb apps
TypeScript rejects a component that returns an array or other non-Element
Its return type 'Element[]' is not a valid JSX element.
TypeScript before 5.1 required every component to return JSX.Element or null, so arrays, strings and Promises were rejected even though React renders them.
2 causes, each with a fixWeb apps
ESLint says it cannot resolve a path to a module that does exist
Unable to resolve path to module 'react'. import/no-unresolved
import/no-unresolved fails when eslint-plugin-import cannot find the file or package on disk with its resolver.
4 causes, each with a fixWeb apps
ESLint reports no-unused-vars for React components and imports that are used
no-unused-vars reported for a component that is rendered as a JSX tag
ESLint's core no-unused-vars does not see variables used only as JSX tags, so a component imported and rendered as <Hello /> looks unused.
3 causes, each with a fixWeb apps
TypeScript rejects MUI Data Grid columns that set a type
A TypeScript error inside a column's renderCell callback
A columns array declared without a type is inferred with type as a plain string, which the Data Grid's column type union does not accept.
2 causes, each with a fixWeb apps
The renderInput prop stopped working on the MUI X DatePicker
The custom TextField (variant, size, helperText) is ignored
renderInput was removed from the MUI X date pickers in version 6.
3 causes, each with a fix