The function passed to renderPage
is potentially re-executed several times until all the pieces of content required by the function have been loaded. It therefore needs to be “pure” like any React render function: idempotent without side effects.
Executes the render
function for a specific page.
The function passed to renderPage
is potentially re-executed several times until all the pieces of content required by the function have been loaded. It therefore needs to be “pure” like any React render function: idempotent without side effects.
The example above renders the markup but does not apply it to the DOM. The result can be used, for example, as the pre-rendered content of the specified page.
Returns
A Promise. The Promise resolves with an object after all the pieces of content the specified page consists of have been loaded. The return value of the function is made available through the result
key of the object the promise is resolved with.
The preloadDump
key contains a dump of all CMS content that was needed to render this page.
About the preload dump
A preload dump contains all the CMS content that was needed to render the page concerned. The preload dump allows you to later preload that content prior to mounting the application. This will make the application startup faster and smoother.
You can store the generated preload dump along with or inside the generated page (e.g. either inside a data-preload-dump
html
attribute or inside a separate .js file) to use it later with Scrivito.preload
. When doing so, please make sure to properly escape and/or encode the preload dump.
Please be aware that the dump is scoped to the Scrivito version. After updating Scrivito, all preload dumps should be regenerated.