Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
No routes matching location "/dash/1"

I have the following problem. my route is not registered and i dont know why.

Links

dashboard.jsx

this code generates all the links.

    <div className="flex w-3/4 m-auto flex-col mt-10 xl:w-1/2">
            {questions.map(({ id, question }) => {
                return (
                    <Link to={`/dash/${id}`}>
                        <QuestionHeader question={question} />
                    </Link>
                );
            })}
        </div>

/dash/1,/dash/2,.... are generated by the map function above.

i have two files that represent the routes.

NavRoutes

const NavRoutes = () => {
    return (
        <Routes>
            <Route path="/:id" element={<Question />} />
            <Route path="" element={<Dashboard />} />
        </Routes>
    );
};
export default NavRoutes;

here is the Main component


const Main = () => {
    return (
        <div>
            <NavBar />
            <NavRoutes />
            <Footer />
        </div>
    );
};

export default Main;

and the main routes for authentication and accessing the main page

const App = () => {
    let { user } = useAuthContext();
    return (
        <div className="w-full bg-slate-700 block fixed h-full">
            <Header />
            <Router>
                <Routes>
                    <Route
                        path="/dash"
                        element={!user ? <Navigate to="/auth" /> : <Main />}
                    >
                    </Route>
                    <Route path="" element={<Login />} />
                </Routes>
            </Router>
        </div>
    );
};

when i try to access /dash/1, i get the following error

router.ts:11 No routes matched location "/dash/1" 
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Did you try the following in your NavRoutes (prepending '/dash' to '/:id'):

<Route path="/dash/:id" element={<Question />} />
about 4 years ago · Juan Pablo Isaza Report

0

i solved this by doing the following

const App = () => {
    let { user } = useAuthContext();
    return (
        <div className="w-full bg-slate-700 block fixed h-full">
            <Header />
            <Router>
                <Routes>
                    <Route
                        path="/dash/*"
                        element={!user ? <Navigate to="/auth" /> : <Main />}
                    >
                    </Route>
                    <Route path="/auth" element={<Login />} />
                </Routes>
            </Router>
        </div>
    );
};

you need to include a * when nesting deeper

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!