IOS上的Chrome在redux/react网站上有一个重定向循环
所以我们在IOS上的Google chrome上遇到了一个奇怪的bug。有一个不断发生的重定向循环。我们正在使用IOS上的Chrome在redux/react网站上有一个重定向循环,ios,google-chrome,reactjs,react-router,redux,Ios,Google Chrome,Reactjs,React Router,Redux,所以我们在IOS上的Google chrome上遇到了一个奇怪的bug。有一个不断发生的重定向循环。我们正在使用React和React路由器 我遇到了一个奇怪的问题,我在末尾添加了一个查询字符串-/#/?_k=p8ttt0,但这不是我们想要做的事情,因为它是一个看起来很奇怪的字符串,会破坏其他路由 下面是我们正在使用的一些代码 import React from 'react'; import { render } from 'react-dom'; import { Provider } fr
React
和React路由器
我遇到了一个奇怪的问题,我在末尾添加了一个查询字符串-/#/?_k=p8ttt0
,但这不是我们想要做的事情,因为它是一个看起来很奇怪的字符串,会破坏其他路由
下面是我们正在使用的一些代码
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react';
import { Router, Route, IndexRoute } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import { syncReduxAndRouter } from 'redux-simple-router';
const store = configureStore();
const history = createBrowserHistory();
syncReduxAndRouter(history, store);
render(
<Provider store={store}>
<div>
<Router history={history} onUpdate={() => window.scrollTo(0, 0)}>
<Route path="/" component={SiteContainer}>
<IndexRoute component={HomeLayout} />
<Route path="a" component={HomeLayout} />
<Route path="b" component={HomeLayout} />
<Route path="c" component={HomeLayout} />
<Route path="d" component={HomeLayout} />
</Route>
<Route path="/styleguide" component={StyleguideComponent} />
</Router>
</div>
</Provider>,
document.getElementById('content')
);
从“React”导入React;
从'react dom'导入{render};
从'react redux'导入{Provider};
从'redux DevTools/lib/react'导入{DevTools,DebugPanel,LogMonitor};
从“react Router”导入{Router,Route,IndexRoute};
从“history/lib/createBrowserHistory”导入createBrowserHistory;
从“redux简单路由器”导入{syncReduxAndRouter};
const store=configureStore();
const history=createBrowserHistory();
syncReduxAndRouter(历史记录、存储);
渲染(
window.scrollTo(0,0)}>
,
document.getElementById('content')
);
以前有人遇到过这个错误吗?如果是这样的话,有解决办法吗
更新1:
所以我发现用
createHashHistory
替换createBrowserHistory
可以解决这个问题,但它仍然在URL中使用丑陋的哈希。有没有办法避免使用这个createHashHistory
组件?我的意思是,我只能在特定设备上使用createHashHistory
(在本例中是IOS
chrome,以及任何其他可能存在此问题的浏览器)。我在一个GitHub
问题中遇到了一个解决方案:-基本上这会告诉您将历史记录
模块更新为
“历史记录”:“^2.0.0-rc3”
我还更新了我的React路由器
模块,因为我遇到了一个问题,我的React路由器
版本需要是支持2.0.0-rc3
“react router”:“^2.0.0-rc5”
我在一个GitHub
问题中遇到了一个解决方案:-基本上这会告诉您将历史记录
模块更新为
“历史记录”:“^2.0.0-rc3”
我还更新了我的React路由器
模块,因为我遇到了一个问题,我的React路由器
版本需要是支持2.0.0-rc3
“反应路由器”:“^2.0.0-rc5”