Closed bkjohnson closed 6 years ago
This is indeed not supported. react_component
renders a <div>
element with some data-
properties, and the JS webpacker-react
part will call ReactDOM.render
for each of these elements at page load.
This would be very hard to handle these use-cases and I am not sure this is the best approach. I would encourage you to create a new component that renders your <Popup>
with the button and the other elements, and then use react_component
to render it from Rails.
Thanks for letting me know, I'll use a wrapper component like you suggested.
I'm using a
<Popup>
element from Semantic UI and I'm using it in a custom element like this:I'd also like to do something similar on the rails side of things so in a view I'm calling the helper like this:
However, after I add
Popup
to myWebpackerReact.setup()
call I get errors in a dependency saying thatElement type is invalid.
. Given the errors, is passing React components as properties like this not supported?