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

90
Views
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
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!