-1

While working with the react-rails library, we can use the react_component() function in an .erb file to add a react component.

How can we use the same function in a .haml file? Or do we have another way of adding a react component in a haml file?

Karan Sapolia
  • 640
  • 9
  • 18

1 Answers1

0

If webpacker is setup in your RoR project, then you can simply use the react_component function from react-rails in the same way we would add ruby code to the haml file.

Ex:

%li
  = react_component("ReactComponent")

This should work correctly. Webpacker will try to locate the React component in app/javascript/components by default.

Karan Sapolia
  • 640
  • 9
  • 18