Module: ViewHelper
- Defined in:
- lib/preact/view_helper.rb
Instance Method Summary collapse
Instance Method Details
#preact_component(name, props = {}, options = {}, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/preact/view_helper.rb', line 2 def preact_component(name, props = {}, = {}, &block) = .reverse_merge(:data => {}) [:data].tap do |data| data[:preact_class] = name data[:preact_props] = (props.is_a?(String) ? props : props.to_json) end return content_tag(:div, '', , &block) end |