I’ve been looking at this tutorial: https://www.kirupa.com/react/creating_single_page_app_react_using_react_router.htm
and my current setup is pretty similar to that example.
The structure of my app right now is basically:
<BrowserRouter>
<div className="App">
<Header>
</Header>
<Switch>
<Route exact path="/" render={pageOne} />
<Route path="/pagetwo/" render={pageTwo} />
</Switch>
</div>
</BrowserRouter>
And then <Link>
components inside pageOne
and pageTwo
to link to each other
How might I make Header
's height change based on the current page? I want Header
to show up on each “page”, and not have to re-render it when changing pages, but I want it to show up with a smaller height on pageTwo
than on pageOne
.
Is there any easy way to do this? One thing I could do is apply CSS attributes to the Header with JavaScript code, but that doesn’t seem very elegant.
Any help would be appreciated!