Op dinsdag 11 oktober 2016 09:45:57 UTC+2 schreef Did: > > Thanks for your reply! Is there a better way to do this or this is a > common solution in elm? >
Well, this is the best way I can think of :) But seriously, as soon as your app grows, some functions in this setup may become big and bloated, with lots of unnecessarily repeated code. Then (and only then) you may want to separate out some functions to separate files. That would very much depend on the direction in which your app will grow first, e.g.: - If your article gets 20 fields instead of , you could put all fields in a Dict, and have a generic update function that takes a key, and updates the field in the Dict. - If you get extensive validation on fields, you may have separate validation on fields before updating model. - If your ID will be provided by a server, rather than your client, that bit of code may change. - If IDs are generated in the client in lots of other places, you could have a separate ID generator helper. - If you want to allow editing of an existing single line, you will need to need a modify (instead of add) function - If you want to allow editing multiple lines at once, .. - Etcetera -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
