Skip to content

Exchanging custom data between routes and data functions in a page module? #214

Answered by dillonkearns
ringods asked this question in Q&A
Discussion options

You must be logged in to vote

elm-pages has an intentionally lean architecture and mental model. The model is:

Given a URL (which will be parsed into RouteParams for a given Page Module), what DataSource should I go get?

That's it. If there was a way to carry over data as part of pre-rendering routes, then it would mean the dev server would need to pre-render all routes each time in order to give you the data for a specific route (that's bad for performance). The same performance cost would apply to rendering a single page in serverless mode (a feature that's currently in alpha).

elm-pages would also need to carry over the underlying data from building up the pre-rendered routes from that DataSource. If you don't need…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ringods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants