今天我为我的反应应用程序提出了一个奇怪的问题。在浏览器中,我可以看到以下错误消息。
Warning: Automatically setting basename using <base href> is deprecated and will be removed in the next major release. The semantics of <base href> are subtly different from basename. Please pass the basename explicitly in the options to createHistory
在index.html中,我添加了导致错误消息的<base href="/">
。
我的index.jsx如下:
import React from 'react';
import {render} from 'react-dom';
import {Router, Route, IndexRoute, browserHistory, Redirect} from 'react-router';
import {Provider} from 'react-redux';
import Layout from './components/layout/layout.jsx'
import HomePageContainer from './containers/homePageContainer.jsx'
import SearchPageContainer from './containers/searchPageContainer.jsx'
import configureStore from './store/configureStore.jsx'
import BroadcastDetailContainer from './containers/broadcastDetailContainer.jsx'
const store = configureStore();
render
(
<Provider store={store}>
<Router history={browserHistory}>
<Route component={Layout}>
<Redirect from='/' to='/home'/>
<Route path="/home" component={HomePageContainer}/>
<Route path="/search" component={SearchPageContainer}/>
<Route path="/broadcast/:broadcastId" component={BroadcastDetailContainer}/>
</Route>
</Router>
</Provider>,
document.getElementById('container')
);
我尝试了一些方法但是没有用。如果删除<base href>
错误,但由于路径问题,详细信息页面或图片将不会显示。