Fork me on GitHub
#re-frame
<
2019-03-30
>
cch101:03:12

I’m new to re-frame and wonder about best practices for integrating multiple sources of state. Clearly re-frame espouses the theory of “keep it all in the app db” but there are less transient repositories that must be considered -particularly remote servers, URL, LocalStorage, Cookies, etc. What is the best practice for coordinating these repositories? Specifically, state in the URL… is the URL a source of events? Is it a repository of state? Do libs like pushy represent the best practice for managing the URL? Part of the problem I find is that URL changes can be natural (such as at startup of the re-frame app or in response to <a> tags) or un-natural (as a result of some other stimulus).

helios12:03:59

does it work with the latest re-frame? Isn't that using still reagent 0.7.0 ?

mikethompson12:03:09

The latest re-frame works fine with reagent 0.8.N

oconn13:03:26

@cch1 In my applications I typically have a layer that wraps each one of those concerns (localStorage, route state, etc..) that are responsible for injecting and updating the app db. I use pushy and bidi for routing and have a re-frame events and subscriptions that keep my app state up to date. I wrote https://github.com/oconn/re-frame-routing to help with that particular problem. You could probably easily swap bidi out for any of the other routing libs.