Next.js Discord

Discord Forum

Can I Cache Static Components in Dev Mode?

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
Hey! I have an app that uses contentlayer to fetch .mdx files and compile them at build time serving them as static pages.

However, some of the components have some costly data fetching functions that are executed when the component loads.

When I change routes or refresh the page all the components are rebuilt, even though the input data never changes. Is there a way to build them only once and then cache them?

0 Replies