dimanche 10 avril 2016

ReactJS and Rails Template Rendering

I am using the react-rails gem and am currently trying to make two components children of a third component.

Previously in my rails view using the react-rails helper and Jbuilder I was able to use the following to render my component:

<%= react_component 'BasketContainer', render( template: 'items/index.json.jbuilder') %>

I am keen to keep using the jbuilder templates I have created but am not sure if this is possible/what the best method would be to implement this into JSX.

Now that I have moved this into a parent component I need to call it in JSX similar to this:

render() {
  return(
    <div class="row">
      <div class="col-xs-12 col-sm-8">
        <ProductContainer render( template: 'products/index.json.jbuilder')) %>
      </div>
    </div>
  )
};

What is the best way to achieve this?

Aucun commentaire:

Enregistrer un commentaire