Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #4055

Closed
nitish24p opened this issue Oct 17, 2016 · 9 comments

Comments

@nitish24p
Copy link

nitish24p commented Oct 17, 2016

Ok i know this is a previous issue too, but when i tried solving the issue with the suggestion given in the earlier issue, i was unable to so can someone please help me out

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { createStore, combineReducers, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import { Router, Route, browserHistory } from 'react-router';
import { syncHistoryWithStore, routerReducer } from 'react-router-redux'
import ReduxPromise from 'redux-promise';

import App from './components/App';
import Foo from './components/Foo';

import rootReducer from './reducers';



const createStoreWithMiddleware = applyMiddleware(ReduxPromise)(createStore);

const store = createStoreWithMiddleware(rootReducer, window.devToolsExtension && window.devToolsExtension());


const history = syncHistoryWithStore(browserHistory, store)



ReactDOM.render(
    <Provider store={store}>
    { /* Tell the Router to use our enhanced history */ }
    <Router history={history}>
      <Route path="/consult/ama" component={App} />
      <Route path="/consult/ama/foo" component={Foo}/>
    </Router>
  </Provider>,
  document.getElementById('mount-node')
);

I get the following error

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

I tried using createHistory explicitly and pass a basename but to no avail. Can anyone help here.

@alisd23
Copy link
Contributor

alisd23 commented Oct 17, 2016

Try passing the history into the <Router /> instead of `browserHistory.

@nitish24p
Copy link
Author

nitish24p commented Oct 17, 2016

Sorry that was a typo.. updated the code.. i had passed history.. still getting the same
Im using gulp for the build process..

@alisd23
Copy link
Contributor

alisd23 commented Oct 17, 2016

Not sure, check versions and simplify the code until it starts working.

@nitish24p
Copy link
Author

"react": "^15.3.2",
    "react-dom": "^15.3.2",
    "react-redux": "^4.4.5",
    "react-router": "^2.8.1",
    "react-router-redux": "^4.0.6",
    "redux": "^3.0.4"

@alisd23
Copy link
Contributor

alisd23 commented Oct 17, 2016

I don't think this is an issue with react-router. Try to get as close to the react-router-redux example as possible. I can't see something obviously wrong from your code.

@alisd23
Copy link
Contributor

alisd23 commented Oct 17, 2016

Maybe try reinstalling dependencies as well, and if you can link your repo I can have a quick look to see if there's anything obvious, there's not really enough information to go off from the code you've supplied.

@nitish24p
Copy link
Author

Ok so the react app is only on 1 route which is part of an entire symfony app. I use nginx as the server config. So my site doesnt have a "/" path the home path for my site is actually "/consult" which is redirected to another repository via nginx and then in "/consult/ama" i have the react app set up. Can this error be possibly because of this configuration?

@alisd23
Copy link
Contributor

alisd23 commented Oct 17, 2016

Possibly, that does seem like quite a unique setup... Have you got a <base href="..." /> tag in your html? Sounds like your issue might be caused by a similar thing to this issue.

@nitish24p
Copy link
Author

Ahh yes.. that seemed to be the issue.. was extending another parent file.. .. Closing.. Thanks @alisd23

@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants