I am interested in making a dynamic Navbar fetching datas from mongodb.
This is my structure :
# src
* [components/]
* [Navbar.js]]
* [Layout.js]]
* [pages/]
* [index.js]
* [_app.js]
Though it is not possible to getServerSideProps
inside of Components
if I am not mistaken, nor inside of _app.js
.
I've heard of getInitialProps
but I haven't been able to wrap my head around it and also it would lead into a nasty prop drilling.
_app.js -> Layout -> Navbar
Now, how would you do a Navbar with dynamics links according to what's fetched from mondodb?