• Accueil
  • Exemples
    Native features
    SSR (getServerSideProps)SSGSSG using fallbackSSG using revalidateCatch-all routes
    Built-in features
    HostingStages & secretsCI/CDStatic i18nMonitoringAPI (Airtable)CSS-in-JSCookies consentAnalyticsIconsCSS AnimationsUI components libraryDocs siteMarkdown as JSX
    Built-in utilities
    I18nLink componentAirtableAsset componentHooksHOCsAPIErrors handlingBundle analysisSVG to ReactSecurity auditTracking useless re-renders
  • Documentation
  • Code source
  • Aller au CMS

Built-in utilities

  • I18nLink component
  • AirtableAsset component
  • Hooks
  • HOCs
  • API
  • Errors handling
  • Bundle analysis
  • SVG to React
  • Security audit
  • Tracking useless re-renders

Previous section - Accueil

HOCs examples

A few HOCs are provided as utilities:
  • withApollo: Wraps a page into an ApolloProvider and handles state rehydration between CSR navigation.
    Can be used with any rendering mode (expect SSG by default).
    Do not use getInitialProps by default, only when useGetInitialProps: true (meant for pages using getInitialProps only).
  • withHOCTemplate: Template for quickly getting started with a new HOC, meant as a utility. Feel free to customise it!

withApollo

This HOC is necessary for all pages in the demo, because all pages need data that are used by shared component (i.e: Nav, Footer).
If you don't need to fetch data from a data source, then you don't need to use it.

1 2 3 4 5 6 7 // Example for a page using getStaticProps or getServerSideProps export default (ExampleHomePage); // Example for a page using getInitialProps export default withApollo({ useGetInitialProps: true })(ExampleHomePage);
We don't actually use the useGetInitialProps option anywhere in this demo, because we don't use getInitialProps anymore.

Utilisateur 1 - 2023
Tous droits réservés

Conditions générales d'utilisation
Politique de confidentialité
/static/images/LOGO_Powered_by_UNLY_BLACK_BLUE.svg