shakacode/react-webpack-rails-tutorial

Mixing React Component with Basic Rails Views

pdurkim opened this issue · 3 comments

I'm looking to use this gem to only render a layout for my Rails app and would like to yield the main content to my old Rails views. Is there a way to achieve this or does every view in my app have to be converted into a component?

Layouts are one by rails. This Gem puts a react component on the page. That component maybe the whole page or part of the page. You don't have to convert any views.

@justin808 What I'm trying to get at is can I have my React component render a top nav and sidebar but keep the main content as a basic Rails view? Or does everything on the page have to be converted to components?

@threepete Yes, no problem for just a header. Use a react component for the top nav and then put rails layout below.

In terms of a sidebar, I don't know off the top of my head how I'd do that. I'm pretty sure you could wire it up, but it wouldn't be as trivial as the example of a top header in React and the below in Rails.