Share Phoenix components between views and live views

Hi all,

in our project we have lots of views and they use lots of
Phoenix.Component.

We have components that renders the full page layouts, and they contains lots of other components… those layouts components take the connection as an attribute…

Now, we would like to add some routes that will use live views and live components.

My questions are:

  • is it doable to only have some routes using live views but sharing the existing phoenix.component to render the layout of the page?
  • my guts tell me I have to remove the dependency from the connection of those components?
  • is there a good practice or an example I can study where the page layout (the header, the footer and a side navigation) is done with Phoenix.component and shared between views and live view?

Thanks a lot
Cheers

2 Likes

Yes. Note Phoenix itself is going in this direction. @flash is now an assign and not in the connection. The new verified routes don’t need a connection nor a socket, etc. assigns should be all you need!

2 Likes