Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

75
Vistas
runtime.js:7 Uncaught Error: [RequireAuth] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>
**react route****I wanted to make a route that's secure but it's not working.**
  <Routes>
    <Route path='/' element={<Home></Home>}></Route>
    <Route path='/home' element={<Home></Home>}></Route>
    <Route path='/register' element={<Register></Register>}></Route>
    <Route path='/login' element={<Login></Login>}></Route>

    <RequireAuth>
      <Route path='/manageproducts' element={<ManageProduct></ManageProduct>}></Route>
    </RequireAuth>
  </Routes>
</div>

Here i implemented require auth but it's not working

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The RequireAuth component needs to be wrapped within a Route as follows:

<Route
    path="/manageproducts"
    element={
        <RequireAuth>
            <ManageProduct/>
        </RequireAuth>
    }
/>;

This would give Routes a child of Route and resolve the error you are getting

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos