React vs Liveview

Hi all,
I am trying to convince my team to use liveview over the current react. What are some of the points where one should consider using liveview instead of react?

To start off:

  1. Using one language to code frontend and back saves us from context switching
  2. Arguably easier to do as there will no need for data serialising and de-seriialising or REST
3 Likes

What’s in it for you? Why are you trying to convince them?

Curious to hear more of your own arguments. (Not saying it’s a bad initiative, but trying to make you express your own reasons, and not the forums)

I am new to liveview, familiar with elm, rescript-react, angular, and various ssr solutions before SPA’s came around.

I am trying to figure out if there are operational downsides to using liveview, since it sounds like liveview changes you from running a mostly stateless backend to a stateful backend? Do you have to put more effort into horizontal scaling and thinking about node fail over?

Mainly because i am allergic to javascript. :smiley:

6 Likes

Elm is great fun, if js is your only objection, but I love the simplicity of server side, no API

Im a fan of elm as well. Keep a look out for this GitHub - gren-lang/compiler.

2 Likes

If you’re fond of automated testing, you can argue that it is way easier to test Liveview code than React.

2 Likes

Have you read the history lesson on why liveview came to be? You may get some answers there.

7 Likes

https://sheer.tj/three_years_of_phoenix_liveview_and_elixir.html#framework_liveview

That’s a pretty long article, but there’s probably 1000 words on phoenix liveview performance, maintainability, etc… but at the end of the day it really depends on your application.

For me the biggest advantage is keeping all data management in one place. With a react front end, you basically have 2 applications, and each requires its own set of patterns, tests, etc to deal with state. In comparison with just react (it is of course possible, arguably necessary, to leverage other libs to help) live view is a lot more equipped to do this in a robust, reliable way.

In my experience, unless you have absolute top of the line expert react devs, you are looking at 3 or 4 or even more times as much dev time.

I guess this falls under “no need for API” but i feel that formulation drastically undersells the advantage.

5 Likes

It’s a nice post by Chris McCord!
LiveView is a very big thing in Web Development history. We need to have a documentary live the Elixir Documentary.

1 Like

I have found that this is actually a great selling point for LiveView. A sizable minority of developers cannot stand writing anything in JS and choose LiveView for that reason.

Another thing is testing. LiveView tests are relatively painless to write. You can bolster this by pointing out that many developers are allergic to testing or documenting anything, and LiveView makes it considerably easier to coax your devs into doing so.

3 Likes