Class: Proscenium::Phlex::ReactComponent
- Inherits:
-
Proscenium::Phlex
- Object
- Phlex::HTML
- Proscenium::Phlex
- Proscenium::Phlex::ReactComponent
- Includes:
- ReactComponentable
- Defined in:
- lib/proscenium/phlex/react_component.rb
Overview
Renders a <div> for use with React components, with data attributes specifying the component path and props.
If a block is given, it will be yielded within the div, allowing for a custom “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.
You can pass props to the component in the ‘:props` keyword argument.
Instance Method Summary collapse
-
#view_template(**attributes) { ... } ⇒ Object
Override this to provide your own loading UI.
Methods included from ReactComponentable
#initialize, #props, #virtual_path
Methods inherited from Proscenium::Phlex
Methods included from AssetInclusions
#include_assets, #include_javascripts, #include_stylesheets
Methods included from CssModules
#after_template, #before_template, included, #process_attributes
Methods included from CssModule
Methods included from SourcePath
Instance Method Details
#view_template(**attributes) { ... } ⇒ Object
Override this to provide your own loading UI.
28 29 30 |
# File 'lib/proscenium/phlex/react_component.rb', line 28 def view_template(**attributes, &) send(root_tag, **{ data: data_attributes }.deep_merge(attributes), &) end |