Fork me on GitHub

@mikethompson @lovuikeng Are there any examples with deeply nested components?


Managing deeply nested, complex components was one of my main goal with re-alm. Each event/message gets routed to the appropriate component's event handler, where the component updates its own (logical) state.


Given that re-frame recomputes all top level subscriptions every time the DB changes, is nesting state recommended over a single flat DB? For example, say I have a login component that stores an email and a password. I can either structure my app DB nested like this:

{:login {:email    ""
         :password ""}}
or flat, like this:
{:login/email    ""
 :login/password ""}
I assume the former is more performant given you'd write your subscriptions like this:
  (fn [db _]
    (:login db)))

  :<- [:login-state]
  (fn [state]
    (:email state)))

  :<- [:login-state]
  (fn [state]
    (:password state)))
Do you guys tend to structure your data nested or flat?


I have had the same thought and still don’t know either.


We generally nest things rather than putting everything at the top level. You can still use namespaced keywords though