3 ms·
I'm working on a framework in Ruby that uses Haml for templating. It is inspired by React and has a VDOM, but it's 100% server side and DOM-patches are streamed
by quechimba 4y ago
I'm working on a framework in Ruby that uses Haml for templating. It is inspired by React and has a VDOM, but it's 100% server side and DOM-patches are streamed to the browser as state updates on the server. Callback handlers are just POST-requests and they are set up like this:
ruby:
def self.get_initial_state(initial_count: 0, **) = {
count: initial_count
}
def handle_click
update do |state|
{ count: state[:count] }
end
end
%div
%p Current count: #{state[:count]}
%button(onclick=handle_click) Increment
I don't know if anyone would be interested in using anything like this.
- shortcake27 4y agoI’m pretty sure there will be interest in this. I like working with FE frameworks but a lot of Rubyists don’t. Ideally many devs just want to work with haml/slim/erb and have an interactive UI without any writing any JS. Your example is really nice because it avoids an entire layer of FE state management / synchronisation. Not sure how much overlap there is with Hotwire as I haven’t really looked into it yet.
- quechimba 4y agoCheck it out if you want, https://github.com/mayu-live/framework https://github.com/mayu-live/framework It's far from production ready, but it's already working reasonably well. I tried HotWire but it didn't feel right to me because I'm used to React.