-
-
Notifications
You must be signed in to change notification settings - Fork 124
Description
Hi,
First, thanks for this great library, I was really enjoying Elm back in the time and I'm excited to try Lustre.
I was very interested in the the 02-nested-updates and the 03-element-map, but they're WIP.
I'm just starting with Gleam and Lustre, my naive thinking is to prefer having the Message, the update and the view inside their own Gleam module and leave the "main" update handle routing and "dispatch" the update to the module currently in action.
If we would have a Login module and a Dashboard module for instance to keep things simple, which both have a Model types:
pub type Model {
Model(username: String, password: String)
}
pub type Msg {
UserClickedLogin
ApiReturnedAuth(Result(String, rsvp.Error))
}Almost the ~same for the Dashboard module and they both would have a view function.
What would it look like in my "main" update and "main" model to support this?
I suppose it would involve having Effect.map and Element.map, but being honest it's very unclear how the Model would look like and how to use them properly etc. I'm just overall a bit confuse.
I don't think I can use the main model to hold all my app state and the update function would be way too long to be comfortable, unless I'm I'm missing something, which is totally possible ;).
Any resources where I can find answers? And maybe if I understand this I could help completing the examples if you need any help.
Thanks for your time.