1234567891011121314151617181920212223242526272829303132333435 |
- import { dehydrate, QueryClient } from '@tanstack/react-query';
- import { GetStaticProps, NextPage } from 'next';
- 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: NextPage = () => {
- return (
- <>
- <Head>
- <title>NextJS template</title>
- <meta name="description" content="Random data with pagination..." />
- </Head>
- <PaginationComponentRQ></PaginationComponentRQ>
- <HoverImageCard />
- </>
- );
- };
-
- export const getStaticProps: GetStaticProps = async ({ locale }: any) => {
- const queryClient = new QueryClient();
-
- await queryClient.prefetchQuery(['randomData', '1'], () => getData('1'));
-
- return {
- props: {
- dehydratedState: dehydrate(queryClient),
- ...(await serverSideTranslations(locale, ['pagination'])),
- },
- };
- };
-
- export default Home;
|