> > Does Elm have best practices for managing and reconciling state between > components and global application state managers?
Yes: don't hold global state in your components' models :) It might help to think about this question differently. Going back to the OP's original question, let's forget about the caching mechanism for a moment, and imagine that all of the "global state" is already loaded into the app (via flags). and that state is stored in the top level model of the app. The first problem becomes: *"I want my components to be able to make use of* * (display)** the global state".* There is already have a good answer for this. Have a look at the sortable table example <https://github.com/evancz/elm-sortable-table> for the answer - any global state/business data that needs to be displayed in a component will be provided to the component's view method from outside of the component. For the OP, this has the added benefit that components no longer need to make http requests to load global state, since the global state is provided from outside of the component. The second problem becomes: *how do we load this global state/business data into the application and cache it?* This requirement is now fairly easy to wire-up in elm since the http requests and data cache all live at the same level of the application (the top level). If anyone wants more details on how to do this, let me know. I hope that helps On Tuesday, August 23, 2016 at 11:11:53 AM UTC-4, suttlecommakevin wrote: > > Great question, OP. I've been wondering about the same thing. React has > pretty clear "best practices > <https://twitter.com/dan_abramov/status/749710501916139520/photo/1>" when > it comes to component vs global state, but it's also not immutable by > default <https://github.com/facebook/react/issues/7287>. > > Does Elm have best practices for managing and reconciling state between > components and global application state managers? > -- 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.
