首页 > 解决方案 > 如何在 react-rails 中调试 ExecJS 错误

问题描述

我正进入(状态;

  Encountered error "#<ExecJS::ProgramError: Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.>

我只有在切换到 时才得到它,prerender:true在此之前我没有收到任何与导入相关的错误。

我怎么能调试这个?问题的原因可能是什么?

引发错误的组件如下所示:

import React from "react";
import { configureStore } from "@reduxjs/toolkit";
import { Provider } from 'react-redux'
import {
  myReducer,
} from "./redux/reducers/reducers";
import Main from "./Main";

const store = configureStore({
  reducer: {
    myReducer: myReducer,
  },
});

function App(props) {
  return (
    <Provider store={store}>
      <Main current_user={props.current_user}></Main>
    </Provider>
  );
}

export default App;

标签: ruby-on-rails-5react-rails

解决方案


推荐阅读