I have a basic rails-react app. Following were my links_controller.rb
class LinksController < ApplicationController
before_action :set_link, only: [:show, :edit, :update, :destroy]
before_filter :authenticate_user!, except: [:index, :show]
# GET /links
# GET /links.json
def index
@links = Link.all
end
end
My react component post_list.js.jsx
as follow:
var PostsList = React.createClass({
getInitialState: function(){
return { lists: this.prop.initialLists };
},
render: function() {
var lists = this.state.lists.map(function(list) {
return <Post key={list.id} list={list} />;
});
return (
<div className="posts">
{lists}
</div>
);
}
});
And my view index.html.erb
as follow:
<%= react_component('PostsList',{initialLists: @links}, {prerender: params[:noprerender].nil?})%>
This result an error:
Thanks!!
Aucun commentaire:
Enregistrer un commentaire