next-cms icon indicating copy to clipboard operation
next-cms copied to clipboard

Reusable menu component

Open jacargentina opened this issue 4 years ago • 1 comments

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

jacargentina avatar Aug 26 '20 02:08 jacargentina

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.

shuding avatar Sep 05 '20 13:09 shuding