qwik
qwik copied to clipboard
[📖] useServerData (in v2)
Suggestion
The documentation for useServerData is currently empty.
@manucorporat mentions in https://github.com/QwikDev/qwik/issues/4506#issuecomment-1597801559:
it's a very low level API, that most developers should never have to use
Should it be mentioned in the docs?
More points:
- It's not clear in what contexts
useServerDatashould work. Is it supported in therouteLoader$, for example? - What is the recommended (high level) alternative for a global server context accessible in
routeLoader$,onStaticGenerate, ... ?
so it's used during SSR to access data that is passed to the render function. At any other point in time it returns nothing. Any data that needs to exist in the client needs to be copied into contexts etc.
for the other cases, just use module scoped data or the requestEv.sharedMap