Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

91
Vistas
How can I conditionally render my Header above this.props.children?

This is my app.js where all the routes

<Layout>
      <Router>
        <Routes>
          <Route exact path="/" element={<Home />} />
          <Route element={<PrivateRoute />}>
            <Route exact path="/dashboard" element={<Dashboard />} />
            <Route exact path="/video" element={<Video />} />]
          </Route>
          <Route exact path="/login" element={<Login />} />
       </Routes>
      </Router>
</Layout>

This is my loyout component

export default class Layout extends Component {
  render() {
    return (
      <div>
        <Router>
          <Header />
        </Router>
        {this.props.children}
      </div>
    );
  }
}

So I have two questions

  1. I could able to use useNavigate in Header since it was not in the surrounded with the <Router> but after using it is working. So is there any better way of doing this?
  2. I need to render conditionally because I don't want it to be on the login page.

Kindly help!!!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda