How can I use a global model in a SPA?

I’m creating a spa and I used this great example that teach me how to make a loggin with firebase https://lengrand.fr/using-firebase-in-elm/
I added that part in one of my pages but has a normal model and I would like that when tha user is loggin can be acccess to the data of the user from another page.
there is a way to can share a model with other page?

1 Like

Check out elm-shared-state, it has an example of using a shared state.

I used to call this shared state a Session but lately I started referring to it as a Context.

2 Likes

thanks for your help man, I’ll revise it.

I found this project super helpful for managing state on various pages:

https://www.elm-spa.dev/

This project has tooling that generates all the boilerplate code for a multipage app.

Component pages can make global updates to the model:

https://www.elm-spa.dev/docs/pages/component

1 Like

If you want a very small example you can check out this one https://github.com/tgelu/elm-spa-example

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.