I have a contact page component that does not fill the viewport, so I need to flex-grow the content section to keep the footer at the bottom. Unfortunately this vanilla solution didn't work in my React project. I adapted it to what I thought would work:
App.js:
import ...
function App() {
return (
<div className="app-container">
<NavigationBar className="nav-container"/>
<Router className="content-container">
<Route exact path="/" component={HomePage} />
<Route exact path="/home" component={HomePage} />
<Route path="/classes" component={GroupClasses} />
<Route exact path="/lessons" component={PrivateLessons} />
<Route exact path="/contact" component={Contact} />
</Router>
<Footer className="footer-container"/>
</div>
);
}
App.css
html,
body,
#root{
height:100%;
margin: 0
}
.app-container{
display: flex;
flex-flow: column;
height: 100%;
}
.nav-container{
flex: 0 1 auto;
}
.content-container{
flex: 1 1 auto;
}
.footer-container{
flex: 0 1 auto;
}