Page.element
pages with state and side-effects.
pages with state and side-effects.
Okay so I lied about /docs/pages/static using Page.static. We actually
need to make an HTTP request on init to fetch content from this markdown file that you're reading.
So for that reason, we're going to upgrade to a Page.element– which is able to
send Cmd Msg and do cool things like making web requests.
Let's use elm-spa add to create an element page like this:
elm-spa add element Docs.Dynamic.Dynamic
Since we are using Dynamic, this route will match paths like these:
/docs/pages/static/docs/pages/element/docs/elm-spa/add
For that first example, our init function receives Params that look like this:
{ param1 = "pages"
, param2 = "static"
}
(You can read more about this in the pages overview)
next up: component