Next.js template
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.js 911B

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