react-rails asset pipeline image path
react-rails asset pipeline image path I'm using the react-rails gem, and I'm having trouble figuring out how to load images from the asset pipeline. I handle this currently by using the .js.jsx.erb extension, but as far as I know this is unconventional. (am I correct?) .js.jsx.erb Sometimes I just use an empty div and and set the div's background-image property as the image I intend to use. background-image What is the best way to go about loading images to react components when using react-rails ? react-rails 1 Answer 1 There are two ways to import image... 1) If you are direct using jsx.erb or js.erb file... jsx.erb js.erb var image_path = "<%= asset_path(my_image.png) %>" OR render: function() { return ( <img src={"<%= asset_url('path/to/image.png') %>"} /> ) } 2) Passing as props Through .erb file to .js.e...