mayu-live / framework

Mayu is a live updating server-side component-based VDOM rendering framework written in Ruby
https://mayu.live
GNU Affero General Public License v3.0
139 stars 4 forks source link

Stateless components #57

Open aalin opened 1 year ago

aalin commented 1 year ago

Components that don't implement any callbacks or have state should be implemented somehow. Not exactly sure how though. Not sure how styles would work with this.

Some sketches:

:ruby
  Greeter = StatelessComponent.define <<~HAML
    %p Hello #{$name}
    :css
      p { font-weight: bold; }
  HAML

  def greet(name) = <<~HAML
    %p Hello #{name}
  HAML

%div
  %Greeter(name="Foo")
  %Greeter(name="Bar")
  = greet("Foo")