asdf is fun!
So the experience is very good. I had ~12 components and 2 live views written in plain LV and took around 2 hours convert 5 of them to Surface until I hit a bit of a block with passing Jason
encoded data for the Leaflet Map hook to consume. I realized it’s probably a bug, reported it and went to sleep, only to see it fixed upon waking up, and completed the transformation without any hiccups. My muscle memory is much more attuned to this syntax as opposed to LV one (after all, it IS a wrapper so it’s meant to be friendlier ;)).
Now for the things I loved about it:
- Syntax is reminiscent of Vue, did not have to stress much to understand how to do what.
- The distinction between LiveView, LiveComponent and Component is nice and explicit
- Awesome declarative is awesome! I get warnings and errors on mismatched prop types (for some of the types at least). I even get warnings if I feed something to a component I did not declare (i.e.
id
in aSurface.Component
(stateless) and not declaring it). - Event handling niceties. Events are types too, declarable! Not remembering to
@myself
was convenient for me. Also:on-click
is more intuitive thanphx-click
(on any other even). - The IDE integration is surprisingly good (I was expecting worse) and there is a to do list on it I look forward too
- There is a
Context
- For me,
<Hello name={{ @name }} />
is better than<%= live_component @socket, Hello, name: @name %>
and<tr :for={{ row <- rows}}></tr>
is better than<tr><%= for row <- rows %>{}<% end %></tr>
- Bulma for examples! So there was this great minds think alike effect
I am still working with it as I type this (which explains the lengthy reply), I cheated on some of the components with :any
as prop/data type so am fixing those and thinking of converting some of the form and input elements with Surface
components. I hope to make the codebase look prettier by tomorrow and then move back to the backend. If you try it out and have any suggestions please reach out!