I am using Fernando Villalobos' Rails + ReactJS tutorial and have run into a (hopefully) simple rendering issue.
I'm using Rails 5.2.1 and the react-rails gem v2.4.7.
Here is the controller logic:
def index
@records = Record.all
end
Here is the view:
<%= react_component "Records", { data: @records } %>
Here is the CoffeeScript:
@Records = React.createClass
render: ->
React.DOM.div
className: 'records'
React.DOM.h2
className: 'title'
'Records'
At this point in the tutorial, the user should see the div, the H2 tag and "Records".
Google Developer's Console confirms React has inserted a <div data-react-class="Records" data-react-props="..."></div> into the HTML - but I don't see any sign of the <h2>Records</h2>. There are no reported errors or warnings. I've tried using equivalent JSX syntax with no change in results. The javascripts/application.js file looks correct too:
//= require rails-ujs
//= require activestorage
//= require turbolinks
//= require react
//= require react_ujs
//= require components
//= require_tree .
What am I missing?
react-railsv1 current version is 2.4.7 maybe try to find a newer tutorial?