12345678910111213141516171819202122232425262728293031323334 |
- import { dehydrate, QueryClient } from '@tanstack/react-query';
- import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
- import Head from 'next/head';
- import HoverImageCard from '../components/cards/hover-image-card/HoverImageCard';
- import PaginationComponentRQ from '../components/pagination/react-query/PaginationComponentRQ';
- import { getData } from '../requests/dataRequest';
-
- const Home = () => {
- return (
- <>
- <Head>
- <title>NextJS template</title>
- <meta name="description" content="Random data with pagination..." />
- </Head>
- <PaginationComponentRQ></PaginationComponentRQ>
- <HoverImageCard />
- </>
- );
- };
-
- export async function getStaticProps({ locale }) {
- const queryClient = new QueryClient();
-
- await queryClient.prefetchQuery(['randomData', 1], () => getData(1));
-
- return {
- props: {
- dehydratedState: dehydrate(queryClient),
- ...(await serverSideTranslations(locale, ['pagination'])),
- },
- };
- }
-
- export default Home;
|