正常情况:
<%= react_component("Users", users: @users) %>
异常情况:
<%= react_component("users/Users", users: @users) %>
在 application.js 中代码如下:
console.log('Hello World from Webpacker')
// Support component names relative to this directory:
var componentRequireContext = require.context("components", true)
var ReactRailsUJS = require("react_ujs")
ReactRailsUJS.useContext(componentRequireContext)