set( )


Sets data in server-side code for use in client-side code.

A performance best practice is to set warmup data for time-consuming operations, such as querying collections or working with the results of network requests from external sites. You can write code that sets the data from these operations as warmup data on the server. The client-side code can then get that data without performing the operations again.

You can only set warmupData on the server. This function has no effect if called from client-side code.

Notes:

  • Rendering never occurs server-side when previewing your site.
  • Server-side rendering only occurs when visitors initially enter the site, and not when visitors navigate from page-to-page within the site.
Method Declaration
Copy
Method Parameters
keystringRequired

A name representing the data to return to the client-side. Key names are unique within a site. Using the same key name within the same site code overwrites the corresponding data.


dataanyRequired

The data to return to the client-side.

Was this helpful?
Yes
No