Module: Proscenium::Phlex::React
- Extended by:
- ActiveSupport::Concern
- Includes:
- Sideload, ReactComponentable
- Defined in:
- lib/proscenium/phlex/react.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 Sideload
Instance Method Details
#view_template(**attributes) { ... } ⇒ Object
Override this to provide your own loading UI.
28 29 30 |
# File 'lib/proscenium/phlex/react.rb', line 28 def view_template(**attributes, &) send(root_tag, **{ data: data_attributes }.deep_merge(attributes), &) end |