While reviewing #347 and reading through the Vike documentation, I realized that we should probably be using the vike-react framework — which is basically a bundled set of configuration options that implements much of the onRenderHTML and onRenderClient logic we had previously managed ourselves. This also changes the way our <head> tags and metadata are configured - those are now constructed in JSX via the /pages/+Head.jsx file, instead of our hacky ejs-templated HTML partial.
For simplicity, right now I'm putting our entire context object in the data field - but I think it probably makes more sense to split up our context values and assign some of them to pageContext and keep data for the actual data loaded in.
While reviewing #347 and reading through the Vike documentation, I realized that we should probably be using the
vike-react
framework — which is basically a bundled set of configuration options that implements much of theonRenderHTML
andonRenderClient
logic we had previously managed ourselves. This also changes the way our<head>
tags and metadata are configured - those are now constructed in JSX via the/pages/+Head.jsx
file, instead of our hacky ejs-templated HTML partial.Vike-React has a slightly opinionated view of how to manage config, which I think actually suits us: there is a global
pageContext
/usePageContext()
hook with server-side data about the request, then a separatedata
/useData()
hook with client-side data sent along to the client.For simplicity, right now I'm putting our entire
context
object in thedata
field - but I think it probably makes more sense to split up our context values and assign some of them topageContext
and keepdata
for the actual data loaded in.