Sha256: 8cb9c46a6d1fdde17c1ee49a6d375d75f27c419e5ac8b5e8940a586e5f4cd54b
Contents?: true
Size: 1.03 KB
Versions: 6
Compression:
Stored size: 1.03 KB
Contents
require 'clearwater/component' require 'store' # Need this for the State module require 'actions' # Need to load the actions we want to dispatch # This is our default homepage component. Note that in the Layout component, we # render this by calling HomePage.new. This means we get a brand-new HomePage # component each time we render, despite the Layout sticking around for the life # of the app. Because of this, our HomePage cannot hold state and only knows # about what it is told in its initialize method (which, in this case, is # nothing). class HomePage include Clearwater::Component include State[:counter, :name] # Add a reader method for attributes in app state def render article([ h1('Welcome to Clearwater'), div([ button({ onclick: Decrement }, '-'), counter, button({ onclick: Increment }, '+'), ]), div([ input(value: name, oninput: SetName), div(name), ]), p(<<-EOP), Clearwater is a Ruby front-end framework. EOP ]) end end
Version data entries
6 entries across 6 versions & 1 rubygems