Organizing LiveView
Explore how to organize Phoenix LiveView applications by using stateless components that compartmentalize markup, manage local state, and enable code reuse. Understand the structure and state flow between parent LiveViews and child components to build scalable, layered interfaces like dynamic surveys efficiently.
We'll cover the following...
Let’s think through the design considerations for our survey. We may eventually want to display the survey in several different places on the site. You could imagine, for example, wanting to place just the product rating portion of the survey on the show page for a given product or just the demographic details portion on some user profile page. And, as we’ve seen, the dynamic nature of the survey represents a decent amount of complexity.
Both of these considerations push us toward components. Having a dedicated place to put the code related to each portion of our survey will allow us to share these concepts across the site. Also, we’ve said before that ...