why are page.tsx files that use "use client" doesn't get cached in the router cache?
Answered
NuclearMonkey posted this in #help-forum
![Avatar](https://cdn.discordapp.com/avatars/371849330585370626/d455ae9da085477f594f8aaa12768025.webp?size=256)
NuclearMonkeyOP
why are page.tsx files that use "use client" doesn't get cached in the router cache? but if it a server component it is cache in the router cache? why is this?
23 Replies
![Avatar](https://cdn.discordapp.com/avatars/890486507872342027/cba9267c0173c6acfde7fa4ba0e70f94.webp?size=256)
Arinji
Router cache dosent cache the actual ui, its for the data. Im guessign in a client page you fetch data in a useEffect? @NuclearMonkey
also dont use client pages
![Avatar](https://cdn.discordapp.com/avatars/371849330585370626/d455ae9da085477f594f8aaa12768025.webp?size=256)
NuclearMonkeyOP
router cache caches the RSC payload right, but why doesn't it cache the client component if the page was a client? I was just curious about this, that's why I was testing putting 'use client' on page
![Avatar](https://cdn.discordapp.com/avatars/890486507872342027/cba9267c0173c6acfde7fa4ba0e70f94.webp?size=256)
Arinji
export default function Home() {
const [loaded, setLoaded] = useState(false);
useEffect(() => {
new Promise((r) => setTimeout(r, 3000));
setLoaded(true);
}, []);
return (
<div>
{loaded && (
<div className="flex flex-col">
CLIENT PAGE <Link href="/">HOME PAGE</Link>
<Link href="/server">SERVER PAGE</Link>
</div>
)}
</div>
);
}
thas my client page
![Avatar](https://cdn.discordapp.com/avatars/371849330585370626/d455ae9da085477f594f8aaa12768025.webp?size=256)
NuclearMonkeyOP
this on dev mode right?
![Avatar](https://cdn.discordapp.com/avatars/890486507872342027/cba9267c0173c6acfde7fa4ba0e70f94.webp?size=256)
Arinji
yup
first requests for all pages take a while
![Avatar](https://cdn.discordapp.com/avatars/371849330585370626/d455ae9da085477f594f8aaa12768025.webp?size=256)
NuclearMonkeyOP
wait ill create sandbox
![Avatar](https://cdn.discordapp.com/avatars/371849330585370626/d455ae9da085477f594f8aaa12768025.webp?size=256)
NuclearMonkeyOP
![Avatar](https://cdn.discordapp.com/avatars/890486507872342027/cba9267c0173c6acfde7fa4ba0e70f94.webp?size=256)
Arinji
yup thats normal
router cache caches the fetch data
not the actual react components
one sec lemme show docs
![Avatar](https://cdn.discordapp.com/avatars/890486507872342027/cba9267c0173c6acfde7fa4ba0e70f94.webp?size=256)
Arinji
![Image](https://cdn.discordapp.com/attachments/1226389489824305192/1226402532964696245/image.png?ex=6624a35d&is=66122e5d&hm=809328456a58f801aa41b7fbeac30fae4616fce425c0e8b8e749f5d07d52ad05&)
Answer
![Avatar](https://cdn.discordapp.com/avatars/890486507872342027/cba9267c0173c6acfde7fa4ba0e70f94.webp?size=256)
Arinji
they are 2 seperate steps, your client page is the 3rd part
it wont just cache react and its hooks since that would lead to a whole lot of bugs
it will cache stuff like fetching data, resolving a promise etc