score:1

Accepted answer

That's actually not the best way to do it, unless you really wanna load react apart from your application.

The documentation states clearly you should do this inside your application.js manifest file:

//= require react
//= require react_ujs
//= require components

The line that mention "components" depends on the folder you actually puts your react component files.

score:2

Try switching your JS includes:

<%= javascript_include_tag "react" %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>

Since you use React in your application JS, it needs to be defined first.


Related Query

More Query from same tag