SSR and SSG
Builder Content
Builder supports SSR and SSG out of the box for all components and frameworks.
This means that you can leverage the benefits of SSR (Server-Side Rendering) and SSG (Static Site Generation), such as improved performance, SEO, and initial page load times, without any additional setup.
For more detail on how Builder works, read How Builder Works: a Technical Overview.
Make sure you're using a framework that supports these features (check your framework's documentation) and follow your framework's guidelines for fetching data server-side when integrating Pages or Sections.
Framework-specific limitations
React doesn't support server-side data fetching for custom components. For React custom components that need to fetch data server-side, you must use Builder's getAsyncProps utility.
To use getAsyncProps(), call the loader function to fetch the Page content and asynchronously resolve any additional data. When the data is resolved, the loader function returns the content for your Remix component:
If you have React custom components that depend on external data sources and need that data server-side, such as a products API, use Builder's getAsyncProps() utility to fetch any data needed server-side before render.
Fetching data for use in the Visual Editor
When using getAsyncProps with the Gen 1 React SDK for SSR or SSG, any data fetched server-side will not be available in the Builder Visual Editor. Since the Visual Editor renders content client-side, components relying on getAsyncProps need a way to fetch data on the client side during editing.
To make your data available in the Visual Editor, you can fetch the data on the client side by extracting any logic you're already using in getAsyncProps, and calling that logic on the client. Use this workaround only while editing, and remove it when editing is complete.
Solve caching issues with your deployed site
If published changes don't appear on your live site, it may be due to caching issues rather than a problem with Builder.
Builder publishes content to its API immediately. Delays in displaying changes are typically due to caching at the hosting provider level or within your application's caching strategy.
Work directly with your hosting provider to adjust caching for your deployed application. Some common guides are included below:
What's next
For more information on server-side data, refer to the getAsyncProps README.