Open mateodif opened 1 month ago
Thanks for the interest! The basic idea of this approach is to use the central data store as the main point of synchronization, for all data needs. I talk about this at some length in my talk (https://vimeo.com/861600197), although I don't go into a lot of detail on networking.
Here's roughly how I would solve an authorization flow using this approach. There would not be an AuthWrapper
component, because the main idea is to only have visual components, and put the semantics of what they're asking the user for in pure data transformation code.
So, here's the rough flow:
[:action/login "username" "password"]
So everything coordinates through the data store, and the rendering logic always makes decisions based on what's in it. There are no components with networking in them, or domain-specific knowledge at all. Components are just generic rendering building blocks, and receives UI data prepared by a pure function (e.g. that transforms domain data to UI data).
Hope that helps!
I'm very interested in this approach, but I'm having a hard time visualizing how to do some basic things like, for example, authorization and fetching data.
For authorization, I imagine the following:
AuthWrapper
component, that takes an initial state with:authenticated? false
and renders a login form:authenticated? true
and the AuthWrapper renders the main component instead of the login form:on-mount
?I can't completely grasp how the complete data flow goes. Any suggestions on what to read, other examples, etc would be great!
Thanks :)