Class: Proscenium::ViewComponent::ReactComponent
- Inherits:
-
Proscenium::ViewComponent
- Object
- ViewComponent::Base
- Proscenium::ViewComponent
- Proscenium::ViewComponent::ReactComponent
- Includes:
- ReactComponentable
- Defined in:
- lib/proscenium/view_component/react_component.rb
Overview
Renders a <div> for use with React components, with data attributes specifying the component path and props.
If a content block is given, that content will be rendered inside the component, allowing for a “loading” UI. If no block is given, then a “loading…” text will be rendered. It is intended that the component is mounted to this div, and the loading UI will then be replaced with the component’s rendered output.
Instance Method Summary collapse
Methods included from ReactComponentable
#initialize, #props, #virtual_path
Methods inherited from Proscenium::ViewComponent
Methods included from CssModules
Methods included from CssModule
Methods included from SourcePath
Instance Method Details
#call ⇒ Object
16 17 18 19 20 |
# File 'lib/proscenium/view_component/react_component.rb', line 16 def call tag.send root_tag, data: data_attributes do tag.div content || 'loading...' end end |