-
I assume that running both aforementioned isn't possible, so the two options I'd have are (use case: running some post-processing on the client):
Is this correct, did I forget anything or other alternatives? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
You can have both
So if you have this server load: // +page.server.ts
const load = () => {
return { numbers: [1, 2, 3] }
} the universal load in // +page.ts
const load = ({ data }) => {
// data is { numbers: [1, 2, 3] }
return { serverData: data.numbers, vowels: ['a', 'e', 'i'] }
} |
Beta Was this translation helpful? Give feedback.
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 thedata
property passed to the+page.ts
load. See the docs:So if you have this server load:
the universal load in
+page.ts
will get the server load return indata