我在使用React / Redux时遇到问题。具体来说,当我在(Google)Chrome上打开我的应用程序时,在浏览器的正常模式下它可以正常工作。但是,在隐身模式中执行此操作会使应用程序崩溃。我不确定发生了什么,但罪魁祸首似乎与Redux有关。错误消息非常模糊,因此无济于事。
下面是新引导的应用程序(create-react-app)的代码片段,除了基本的redux连接外,几乎没有添加任何内容。我还链接了显示错误的图像。
项目的入口文件(index.js)
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router } from 'react-router-dom';
import { Provider } from 'react-redux';
// Stylesheets
import 'semantic-ui-css/semantic.min.css';
// Main App
import App from './components/App';
// Store config
import configureStore from './store';
const store = configureStore();
ReactDOM.render(
<Provider store={store}>
<Router>
<App />
</Router>
</Provider>,
document.getElementById('root')
);
存储配置
import { applyMiddleware, compose, createStore } from 'redux';
import thunk from 'redux-thunk';
import logger from 'redux-logger';
import rootReducer from './reducers';
function configureStore() {
return {
...createStore(
rootReducer,
compose(
applyMiddleware(logger, thunk),
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
)
),
};
}
export default configureStore;
减根器
import { combineReducers } from 'redux';
import { reducer as reduxFormReducer } from 'redux-form';
const rootReducer = combineReducers({
form: reduxFormReducer,
});
export default rootReducer;
应用组件
import React from 'react';
function App() {
return (
<div>
App
</div>
);
}
export default App;
Chrome Incognito中的错误