next-cms
next-cms copied to clipboard
Reusable menu component
I need somehow to render a menubar, rendering links from some external data.
I can do it with getStaticProps in _app.js page, passing data via some react context
But that way, If only 3 of 100 pages use that menu component, then 97 pages would fetch unneeded data
This solution seems interesting, as i think it fits right? But also this requires adding withCMSPage to every page for a “possible” CMS component present on the page tree?
Thanks a lot
Correct! With this solution it will automatically collect the data that is used in the page and "generate" getStaticProps
for it. But you have to add that HoC to every page, otherwise it will be hard to do the detection.