dli

dli

How to integrate Hologram with existing LiveView app?

Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?

Looking for hints regarding:

  • Adding a Hologram component to a LiveView page
  • Sending commands / events between LiveView and Hologram components (e.g. JS.push, JS.dispatch)
  • Having Hologram router + LiveView router at the same time
  • Any other tricks and pitfalls that come to mind

Cheers!

Most Liked

olivermt

olivermt

Yeah I wouldnt mix them. I ported a 84kloc react app with tons of local state with complex multi stage forms.

Love it!

A few sharp edges for sure, but bart is really into this thing so he is on it if you find bugs :slight_smile:

jam

jam

I hope someone answers your question but I suppose another option would be to just go whole hog and convert everything from LiveView to Hologram. I think @olivermt did this recently. He may be able to share more.

bartblast

bartblast

Creator of Hologram

Mixing them on the same page isn’t technically possible today, and even if it were, I wouldn’t do it - two runtimes competing for one DOM just doesn’t make sense, and there’s no event bridge between them by design. The good news is that converting LiveView to Hologram is a far shorter hop than the React port @olivermt did - both are declarative Elixir, so it’s mostly a mechanical translation, and AI tools handle it really well (honestly one of the best use cases for them). During the migration you can keep both routers side by side and convert page by page.

Last Post!

bartblast

bartblast

Creator of Hologram

The colocated JS part is the step you get to skip entirely. You do not write JS with Hologram, you write Elixir and Hologram compiles it to run in the browser.

Which is also why mixing is a bad trade. Wiring two very different execution models together is a large amount of work for a small payoff, and converting a page gets you the same interactivity without the bridge.

Yeah, already in the short-term goals - coming soon!

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 131117 1222
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement