0

Today i come up with a strange issue for my react application.In the browser i can see the following error message.

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

In the index.html i have added <base href="/"> which causes the error message.

I have the index.jsx as follows:

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')
);

I tried some methods and which is not working. If remove <base href> the error will go but the detail pages or the images will not be show due to the path issue.

gitu
  • 219
  • 6
  • 18
  • Its a Warning and not an Error message. You can overlook warnings, but if you want to remove Warnings as well then google the replacement of in the docs – iamsaksham Apr 10 '17 at 12:12
  • You can set baseUrl in react-router v4 https://stackoverflow.com/a/43533070 – shahonseven Nov 11 '17 at 16:38

0 Answers0