03juan

03juan

Continuing the discussion from Looking for a guide to setup a pure esbuild and svelte for Phoenix API app:

My main reasons for wanting to implement a Client-side rendering framework over LiveView:

  • Lots of client-side reactive interactions that don’t require a constant connection to the server. e.g. manging large data tables and displaying charts and dashboards based on the data.
    • Here LV could cause a noticeable lag as requests are sent to the server, processed, and then all the relevant areas of the DOM are updated from the resulting diff. One can use lots of LiveView.JS and hooks code to glue things together, but this could become quite complex where using a self-contained client-side application would improve the development experience.
  • Creating a web application that is primarily going to be used in areas that have very poor internet connectivity.
    • This would require good caching and syncing strategies such that the user is able to do their work and then the changes are synchonised with the server whenever the connection is restored.

I’m sure others will be able to add to this list from their own experiences.

Showing Posts 1 to 5

bdarla

bdarla

Thank you for responding to my question!
I guess as a first step, I need to dig deeper into Svelte to understand the details.
However, if I am not mistaken, Svelte is not like React. If I understood correctly from the quick glance I had, it is also an SSR solution. Although it can support SPA, as I understood, it is not really recommended (not studied the details for this though).
Anyway, I only wanted to see if there something explicit in that project that rendered Svelte as the optimal solution.

03juan

03juan OP

Svelte started as a pure client-side reactive rendering library and a direct competitor to React’s client-side framework.

They have both evolved to also include server-side rendering functionality as javascript/node backend developers wanted the same ability that we’ve always had with LiveView, for the server to create the initial page rendering and then the client-side code takes over the reactivity.

03juan

03juan OP

I don’t see it as a matter of what is recommended, but what are the project’s requirements.

As a js/node dev, I would want to have my server generate the html (SSR) and then my client-side app take over the interactions (CSR). In this case I would logically reach for the same tool to do the job, so use svelte/react/etc. for both SSR and CSR.

As a LiveView dev, I would want to generate as much as possible from LV, and if the need arises refactor some of my code and templates to run purely in the client. Here there a couple of options

  • using LiveSvelte.render in LiveView to SSR the svelte component, and then svelte CSR takes over the reactivity
  • importing the compiled svelte components into the HTML and calling the CSR component, passing the relevant data props to make it work

Hope this helps :smile:

bdarla

bdarla

Thank you for the elaborated responses! Indeed, Svelte can very well be a replacement for React (or Liveview).

roganjoshua

roganjoshua

You can use Both - where aplicable and they work together quite easily and well.

https://medium.com/@alistairisrael/phoenix-1-7-with-svelte-12257d853ed1

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews