Next.js template
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 1018B

12345678910111213141516171819202122232425262728293031323334
  1. import { dehydrate, QueryClient } from '@tanstack/react-query';
  2. import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
  3. import Head from 'next/head';
  4. import HoverImageCard from '../components/cards/hover-image-card/HoverImageCard';
  5. import PaginationComponentRQ from '../components/pagination/react-query/PaginationComponentRQ';
  6. import { getData } from '../requests/dataRequest';
  7. const Home = () => {
  8. return (
  9. <>
  10. <Head>
  11. <title>NextJS template</title>
  12. <meta name="description" content="Random data with pagination..." />
  13. </Head>
  14. <PaginationComponentRQ></PaginationComponentRQ>
  15. <HoverImageCard />
  16. </>
  17. );
  18. };
  19. export async function getStaticProps({ locale }) {
  20. const queryClient = new QueryClient();
  21. await queryClient.prefetchQuery(['randomData', 1], () => getData(1));
  22. return {
  23. props: {
  24. dehydratedState: dehydrate(queryClient),
  25. ...(await serverSideTranslations(locale, ['pagination'])),
  26. },
  27. };
  28. }
  29. export default Home;