JSON with LiveView

Hey there.

I actually think it’s an idea with a lot of potential and use-cases that could be supported either in LiveView or as a separate library.

Being able to use whole React ecosystem while keeping the state in sync with your GenServers (or other abstraction) is something that we already experimented with. Take a look at this repo: https://github.com/surferseo/livedata_todomvc which is a proof of concept for the idea.

While the POC implementation is hideous, the API is really clean and powerful - check out https://github.com/surferseo/livedata_todomvc/blob/master/lib/phoenix_livedata_todomvc_web/live_data/todo_state.ex and https://github.com/surferseo/livedata_todomvc/blob/master/assets/js/containers/TodoList.js#L22.

If you are interested in hearing more, check out this video https://www.youtube.com/watch?v=fvNy9bh8_vs where I talk a bit about motivations and the ugly internals.

Trying to make it play well with LiveView makes a lot of sense, as it lowers the barrier of entry to integrate it with existing JS codebases.

5 Likes