Skip to content
Discussion options

You must be logged in to vote

You can have both +page.ts and +page.server.ts. The return value of the load function in +page.server.ts will be passed as the data property passed to the +page.ts load. See the docs:

Universal load functions are called with a LoadEvent, which has a data property. If you have load functions in both +page.js and +page.server.js (or +layout.js and +layout.server.js), the return value of the server load function is the data property of the universal load function's argument.

So if you have this server load:

// +page.server.ts
const load = () => {
  return { numbers: [1, 2, 3] }
}

the universal load in +page.ts will get the server load return in data

// +page.ts
const load = ({ data }) => {
  

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@205g0
Comment options

@geoffrich
Comment options

@205g0
Comment options

@flawnn
Comment options

@geoffrich
Comment options

Answer selected by 205g0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants