get( )


Gets data from server-side code for use in client-side code.

A performance best practice is to get warmup data on the server 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.

Getting the warmupData data retrieves data that was set on the server and makes the data accessible from the client-side.

You can only get warmupData in the client-side code.

  • This function returns null if called while on the server.
  • If this function runs before warmupData.set(), it returns undefined.

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. Until rendered, the data is undefined.

Returns
Return Type:any
Was this helpful?
Yes
No