markevans

markevans

Komodo - easily render React, Svelte, Vue, Angular, any JS framework component from Liveview

Hi there!

I’ve created a small library, Komodo, that allows easy use of JS framework components from Phoenix LiveView.

Each framework just needs a small piece of easy-to-write Javascript adapter code to work with it (this is already provided for React, Svelte, Vue and Web Components).

komodo-short

Rationale

There are a few libraries already out there for rendering JS components (for React, Svelte, etc.) from LiveView, however I personally wanted a few things which they all seemed to be missing:

  • A standard interface for interacting with different frameworks
  • To be truly reusable, JS components should have no knowledge of LiveView (many other libraries require them to know about pushEvent) - with this separation it’s now easy to drop in third-party reusable components without needing to wrap them in a LiveView-aware wrapper
  • separation between a) compiling the component into JS and b) actually using the component (other libraries do both things for you) - you may not even want to compile, say, Svelte components if you’re only pulling in third-party ones
  • easily use components from different frameworks in the same app

This is a fairly simple first pass, but to be honest I’m not sure if anything more complicated is needed.
For example, currently all props are sent down the wire when a prop is changed, but to send only the prop that changed down the wire we’d need to keep more state in memory in the LiveView process, which may be a worse trade-off if there are many users. Something to think about for the future anyway.

Please let me know if you have any feedback!
Links below - thanks!

Mark

https://github.com/hungry-egg/komodo

Most Liked

juliolinarez

juliolinarez

I’ve only just found this library. I tried to do the same from the scratch. Looks awesome ! Thanks

Where Next?

Popular in Announcing Top

kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
treble37
Just looking for a little feedback on a tiny helper library I built - Sometimes I find the need to convert maps with atom keys to maps w...
New
kip
ex_cldr provides localisation and internationalisation support based upon the data from the Unicode CLDR project. Unicode released CLDR ...
407 13366 120
New
dominicletz
Hi, I thought I had posted my library before but seems I hadn’t. The project is still in early stages but it’s growing and so I think it...
New
trisolaran
Hi! :waving_hand: I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
198 11283 107
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 10796 134
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement