Reuse the value of a tRPC query done in generateMetadata in the page
Answered
Southern African anchovy posted this in #help-forum
Southern African anchovyOP
Hello,
Is there a way to reuse the result of a tRPC query in my page ?
So I don't have to to 1 fetch for the metadatas and 1 fetch for my component, please ?
Or maybe, access the route params outside of the page function ?
Is there a way to reuse the result of a tRPC query in my page ?
So I don't have to to 1 fetch for the metadatas and 1 fetch for my component, please ?
Or maybe, access the route params outside of the page function ?
4 Replies
@joulev https://discord.com/channels/752553802359505017/1275085049879990362/1275088421144100917
Southern African anchovyOP
woooow mate thank you, that's exactly what I was testing out while waiting for an answer 😄
Idk if trpc in your set up already has React.cache or not but most likely not – in that case just add React.cache in
@joulev Idk if trpc in your set up already has React.cache or not but most likely not – in that case just add React.cache in
Southern African anchovyOP
Thanks! A lot. I was pretty much unaware of the react "cache" function