Same API call in layout and page component
Unanswered
Tornjak posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
TornjakOP
Hello! I was curious about something today. I'm trying to fetch things from the layout, to show data on the layout, but then I also need those data on the page itself. So I'm making a similar call in both places, and I wonder if this triggers two calls to that API.
Is that a problem you think ?
Is that a problem you think ?
3 Replies
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
you could use
https://react.dev/reference/react/cache#noun-labs-1201738-(2)
cache
from react to dedup the requesthttps://react.dev/reference/react/cache#noun-labs-1201738-(2)
![Avatar](https://cdn.discordapp.com/embed/avatars/0.png)
TornjakOP
I'm using the T3 stack, with trpc and react query, I wonder if they are handling that automatically 🤔 thanks for your answer 🙌
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
react-query should handle it if you are fetching on client side