2

I am using react_on_rails for developing a Rails Engine and an application.

I have written a rails engine which has a single component - NewComponent. It uses react_on_rails. This has been tested via the dummy application of the rails engine. I imported and registered the component in dummy application: /new_engine/test/dummy/client/app/Index.jsx:

import NewComponent from '../../../../client/app/pages/user_home_page/NewComponent';

ReactOnRails.register({
NewComponent,
});

The above worked completely fine in the dummy app. And I was able to further render this registered component in the view.

Now I am consuming this react component as a mountable rails engine in a full fledged application. How can I import this component so that I can register it in the application? In the dummy application I was able to give a relative path to import the component. Such a relative path will not be possible in the application while consuming the gem.

I have checked online for an answer to this, but there seems to be very less documentation on react_on_rails with engines.

Alex Jose
  • 278
  • 3
  • 17
  • I'm not sure that react_on_rails currently supports creating a component which is then registered with the parent application rather than the engine. I suggest creating a feature request for this on https://github.com/shakacode/react_on_rails – Judah Meek Apr 24 '18 at 22:48

0 Answers0