What is the correct way to design an Phoenix LiveView application?

Hi :wave:t2: elixir community,

How should I design my LiveView application? I have a very simple application, that consists of basically 3-4 pages at the moment.

Main page has a list of posts. Those posts could be saved. User then can navigate to saved posts page, and there is also static about page. Then there is a common navigation bar, where I have links to navigate between those three views and some state (show how many items are saved near saved page link)

My confusion is, how should I handle these separate pages. Should I register 1 live route per page? Then, how do I handle common parts, like for example a navigation bar.

I come from React world, where I would have root component, that has general layout, including navbar, footer, sidebar (all of which are components on their own), and then somewhere for main content part, i can put router, that will mount different components based on the route. Here, I am a bit lost, since each live route seems to me as completely separate

2 Likes

I am in the same boat and had similar question. Here’ the link


It doesn’t answer all of yours but should definitely clear things up a little. Pedro’s reply is the one that got me going although now trying to figure out how na bar links should work.

1 Like