Any way to dynamically cache routes on server side? #13017
shahriar-shojib
started this conversation in
General
Replies: 1 comment 2 replies
-
Generating the HTML is almost always fast, so instead of caching the HTML, you could cache the data inside the loaders, which is typically the slowest part. If you still want to cache the data, maybe to reduce server loader, you can use the Cache-Control header in the response to instruct the browser and/or CDN to cache it. Also, the code in the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a route like this
/blog/:slug
now on the server entry I naively tried to cache the HTML and then serve the cached response on subsequent requests like so:
This still calls the loader of the route before coming to this stage. Is there a way to do what I am trying to do with react-router-7 ?
Beta Was this translation helpful? Give feedback.
All reactions