import React from 'react';
import ReactDOM from 'react-dom';
import Map from './components/map/container/map';
import App from './App';
import './index.css';
import shell from './shared/utility/shell';
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore, applyMiddleware, compose } from 'redux'
import { routerMiddleware, ConnectedRouter } from 'react-router-redux'
import thunk from 'redux-thunk'
import createHistory from 'history/createBrowserHistory'
import rootReducer from './reducers'
import registerServiceWorker from './registerServiceWorker';
import { Routes } from './config';
const history = createHistory();
const target = document.querySelector('#root')
const initialState = {};
const enhancers = [];
const middleware = [
thunk,
routerMiddleware(history)
];
if (process.env.NODE_ENV === 'development') {
const devToolsExtension = window.devToolsExtension;
if (typeof devToolsExtension === 'function') {
enhancers.push(devToolsExtension());
}
}
const composedEnhancers = compose(
applyMiddleware(...middleware),
...enhancers
);
const store = createStore(
rootReducer,
initialState,
composedEnhancers
);
render(
<Provider store={store}>
<ConnectedRouter history={history}>
<div>
<Routes />
</div>
</ConnectedRouter>
</Provider>,
target
)
registerServiceWorker();
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
を期待私はReduxのの助けを借りてからAPIを呼び出して、テーブル内のデータを表示しようとしています。私はこのエラーが発生しています。上記は私のindex.js
ファイルです。エレメントタイプが無効である:(内蔵部品のための)文字列またはクラス/機能
1. エレメントタイプが無効である:(内蔵部品のための)文字列または(複合コンポーネント用)クラス/機能を期待したが得た:未定義。あなたはおそらく、それはで定義されていたファイルからコンポーネントをエクスポートするのを忘れ
2. React.createElement:タイプが無効です - (内蔵部品のための)予測文字列またはクラス。/function(複合コンポーネント用)ですが、未定義です。コンポーネントを定義したファイルからエクスポートするのを忘れた可能性があります。
私は多くの回答を参照しました。私はこのエラーを認識できません。
反応しているコンポーネントまたは機能ではないものをレンダリングしようとしています。あなたがレンダリングしているカスタムのものと思われるので、問題はあなたの 'App'か' Routes'でしょう。これらのファイルとインポートするファイルからエクスポートをダブルチェックします。 @AustinGrecoのように –
が言った、それはインポート/エクスポートの問題です。 [これをチェックしてください](https://github.com/ReactTraining/react-router/issues/4477) – taha
私はあなたがそれを解決したかどうかわからない、私は一度同じトラブルに遭遇していた、 react-router-reduxの古いバージョンのreact-router-redux @ next(5.0.0-alphaN)のコードです。 – pingz