Skip to content

(JQuery 3 is incompatible) Helper method react_component not working unless I manually mount component #742

Closed
@kristophM

Description

@kristophM

Help us help you! Please choose one:

  • My app crashes with react-rails, so I've included the stack trace and the exact steps which make it crash.
  • My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.
  • I'm trying to use react-rails with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.
  • I have another issue to discuss.

Hi guys,

Great gem! I am facing an issue in which my <%= react_component %> helper is not displaying right away. If you notice in the screenshot "before.png", The inspector definitely shows this helper getting translated into the data-react-class html object. However, there is no HTML being rendered inside of it. THEN, I manually run ReactRailsUJS.mountComponents() after the page loads and as you can see in "after.png", it loads everything successfully!

I've followed the instructions in the README as well as other tutorials, yet the helper is not working automatically. Please let me know if I can provide any additional information to debug this. Thank you!

Kristoph

before:
before
after:
after

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions