I'm creating a website using NextJS and Strapi as CMS. I would like to edit navbar links from Strapi.
In my NextJS app I created a layout component to wrap my pages in the _app.js file. This layout is containing header, navbar and footer. Here it is the file architecture :
pages:
- _app.js
- index.js
- page1.js
layouts:
- default.js
services:
- menuService.js
As my Layout component wrap the pages in _app.js I don't know where server-side calls the links for my navbar by calling Strapi API. Indeed, I can't use getServerSideProps() in _app.js because NextJS doesn't handle it and getStaticProps() renders client-side when we use component Link to redirect the user.
Actually I'm stuck and don't know how to do. This is really simple feature but it seems that NextJS doesn't handle this kind of dynamic content actually.
The only solution I found at present is to use my Layout component in all of my pages to wrap the content directly (not throught _app.js) and use the props returned by getServerSideProps() in the same pages. But this is a really heavy solution.