Answer the question
In order to leave comments, you need to log in
Rails helpers in React.js?
Here I did everything using slim (nice and understandable)
- @test.each do |res|
= link_to root_url(subdomain: res.url) do
.images style="background-image: url(#{res.image_url(:images).to_s})"
- if params[:page].blank?
h1 = res.title
var Test = React.createClass({
render: function() {
var imgUrl = 'http://example.com' + this.props.data.id + '/' + this.props.data.image; // Нифига нельзя работать под дев
var divImg = {
backgroundImage: 'url(' + imgUrl + ')'
};
return (
<a href="???">
<div className="images" background-image={divImg}>
</div>
if ???
<h1>
{this.props.data.title}
</h1>
</a>
);
}
});
Answer the question
In order to leave comments, you need to log in
You need to send ready-made urls from rails to react. Including for different versions of files from carrierwave. And you can also write the address without a domain, then the current domain will be used
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question