Hacker News new | ask | show | jobs
by POiNTx 812 days ago
I created LiveSvelte, let me know if you have any questions :)
1 comments

Is there any reason you can think of to still use JS Hooks if using LiveSvelte?
With hooks you are able to render your html server side while still having some js functionality. Technically you can also render server side with LiveSvelte as it supports SSR out of the box, but this SSR uses Node and that introduces a slight performance decrease (around 3ms I believe).

I've been looking at Bun to see if it would help but it's still unclear to me.

Heex rendering is just way faster.

If you don't care about SSR for certain components (for example modals, they don't need SSR generally), then I don't see a clear advantage for hooks.

If you just need one simple thing in your app that uses JS it might be overkill to bring in LiveSvelte only for that.
That's true. And another downside is that once you're in the Svelte environment you can't use your Phoenix components inside those Svelte components.

I've thought about adding a library of default Svelte components which mirror the core components you get from Phoenix out of the box. But then again you lose forms and changesets etc, it's just annoying.

Where I see LiveSvelte fit is where you really need a lot of complex client side state. Sprinkle it in, but keep using phoenix components as your default, even with hooks