import { headers } from 'next/headers';
import { PageProps } from '@/lib/getCategories';
export default async function Page({ params }: PageProps) {
const head = headers(); // forces page to be revalidated on every request
const joke = await fetch('https://icanhazdadjoke.com/', {
headers: {
Accept: 'application/json',
},
cache: 'no-store',
}).then((res) => {
return res.json();
});
return (
<div>
<h1>Dad Jokes</h1>
<p>{joke.joke}</p>
</div>
);
}
import { headers } from 'next/headers';
import { PageProps } from '@/lib/getCategories';
export default async function Page({ params }: PageProps) {
const head = headers(); // forces page to be revalidated on every request
const joke = await fetch('https://icanhazdadjoke.com/', {
headers: {
Accept: 'application/json',
},
cache: 'no-store',
}).then((res) => {
return res.json();
});
return (
<div>
<h1>Dad Jokes</h1>
<p>{joke.joke}</p>
</div>
);
}