Hacker News new | past | comments | ask | show | jobs | submit login

True, in this particular case it does seem inefficient. And of course there's nothing stopping one from just doing this with a bit of js.

But in the bigger picture, the advantages of this approach are huge:

1. no need to maintain state, routing, and so on on the front- and backend, which removes a huge source of complexity. It's all in one place. And if something in the DB is updated, it's trivial to make it live-update the client state. And because of websockets, such an update is almost instant.

2. being able to use the same language (and templating) on server and client (for the most part).

3. the ability to just use regular function calls to retrieve data, and selectively display what you want by using it in templates. No need to set up endpoints for the client, and no need to worry that perhaps accidentally the endpoint might send data down the wire that shouldn't be there (and that you might not notice because the JSX doesn't display it). I think in just the past year I've read about a number of serious data leaks that were basically a result of this.

4. no need (or not as much need) to keep an eye on the js payload. Want to format dates in particular way? Just add the dependency and use it however you like. It's only diff in the output that gets sent to the client!

5. little to no need to deal with a complicated build process.

6. server-side rendering out of the box, and in a simple manner!

7. less taxing on the client. No need for processing templates and a lot of code. Of course, the downside is that the server has to do more work.

Now obviously latency can be a downside, as is (potentially) increased memory and processor usage on the server. It's not a magic solution to everything :). Hell, my last project still needed quite a bit of javascript for some heavy interactivity where latency had to be avoided. But it's still astounding to me how many projects have become drastically simpler with the LiveView-approach!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: