React with Redux 应用程序仅在安装了 redux 工具时才有效
React with Redux app only works if redux tools installed
我用 React 和 Redux 构建了一个应用程序。我以标准方式构建应用程序。
npm run build --prod
然后应用程序被部署到 firebase 托管。我发现除非安装了 redux web 开发工具,否则该应用程序不会在 Chrome、Firefox 或 Safari 中加载。为什么会这样,我该如何阻止它?
该应用程序位于... https://triviatime-e7aa2.web.app/
使用 redux-devtools-extension npm 包配置 redux 开发工具。
import { composeWithDevTools } from "redux-devtools-extension";
export const store = createStore(
rootReducer,
composeWithDevTools(applyMiddleware(...middleware))
);
有关详细信息,请参阅以下 link 中的第 1.3 节。
https://github.com/zalmoxisus/redux-devtools-extension#12-advanced-store-setup
另一种选择
import { createStore, applyMiddleware, compose } from 'redux';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(reducer, /* preloadedState, */ composeEnhancers(
applyMiddleware(...middleware)
));
我用 React 和 Redux 构建了一个应用程序。我以标准方式构建应用程序。
npm run build --prod
然后应用程序被部署到 firebase 托管。我发现除非安装了 redux web 开发工具,否则该应用程序不会在 Chrome、Firefox 或 Safari 中加载。为什么会这样,我该如何阻止它?
该应用程序位于... https://triviatime-e7aa2.web.app/
使用 redux-devtools-extension npm 包配置 redux 开发工具。
import { composeWithDevTools } from "redux-devtools-extension";
export const store = createStore(
rootReducer,
composeWithDevTools(applyMiddleware(...middleware))
);
有关详细信息,请参阅以下 link 中的第 1.3 节。 https://github.com/zalmoxisus/redux-devtools-extension#12-advanced-store-setup
另一种选择
import { createStore, applyMiddleware, compose } from 'redux';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(reducer, /* preloadedState, */ composeEnhancers(
applyMiddleware(...middleware)
));