Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs React Router 1.0替代Router.HistoryLocation_Reactjs_React Router - Fatal编程技术网

Reactjs React Router 1.0替代Router.HistoryLocation

Reactjs React Router 1.0替代Router.HistoryLocation,reactjs,react-router,Reactjs,React Router,react Router 1.0中用于从URL中删除哈希的Router.HistoryLocation的替代方案是什么 Router.run(routes, Router.HistoryLocation 有一个独立的包,它是建立在路由器上的。默认情况下,它将使用推送状态版本。您可以在中阅读关于使用其中一个的内容,但我更喜欢使用createHistory: import { createHistory } from 'history' ReactDOM.render( <Router

react Router 1.0中用于从URL中删除哈希的Router.HistoryLocation的替代方案是什么

Router.run(routes, Router.HistoryLocation
有一个独立的包,它是建立在路由器上的。默认情况下,它将使用推送状态版本。您可以在中阅读关于使用其中一个的内容,但我更喜欢使用
createHistory

import { createHistory } from 'history'

ReactDOM.render(
  <Router history={createHistory()}>{routes}</Router>,
  document.getElementById('root')
);
从'history'导入{createHistory}
ReactDOM.render(
{routes},
document.getElementById('root'))
);
react路由器是建立在一个单独的软件包上的。默认情况下,它将使用推送状态版本。您可以在中阅读关于使用其中一个的内容,但我更喜欢使用
createHistory

import { createHistory } from 'history'

ReactDOM.render(
  <Router history={createHistory()}>{routes}</Router>,
  document.getElementById('root')
);
从'history'导入{createHistory}
ReactDOM.render(
{routes},
document.getElementById('root'))
);

通过使用上述代码,我只能使用url或。我无法转到其他路由,路由器正在重定向到索引路由。我想替换散列。我的URL应该是。您是否正在使用链接组件编写链接?在您的服务器上,或者将请求重定向到index.html,或者使用Router.match?通过使用上述代码,我只能使用url或。我无法转到其他路由,路由器正在重定向到索引路由。我想替换散列。我的URL应该是。您是否正在使用链接组件编写链接?在您的服务器上,是否将请求重定向到index.html或使用Router.match?