next js still caches data even on refresh, it needs hard refresh to get new data
Unanswered
NuclearMonkey posted this in #help-forum
export default async function Home() {
const response = await fetch(
`https://www.randomnumberapi.com/api/v1.0/random`
);
const data = await response.json();
return (
<div>
<p>{data[0]}</p>
</div>
);
}5 Replies
I keep refreshing the page but it still gives the last data
It needs a hard refresh to get the new data
why is this
nextjs has a pretty aggressive caching mechanism. check this docs out, should pretty much answer your questiosn