-
Notifications
You must be signed in to change notification settings - Fork 163
React-router-bootstrap is not working with react-router 5.0.0 #250
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
Comments
Here's a workaround until #248 is released: import React from 'react';
import PropTypes from 'prop-types';
import { BrowserRouter, withRouter } from 'react-router-dom';
<BrowserRouter>
<RouterContextProvider>
// ...
</RouterContextProvider>
</BrowserRouter>
const RouterContextProvider = withRouter(
class extends React.Component {
static childContextTypes = {
router: PropTypes.object
};
getChildContext() {
const { children, ...router } = this.props;
return { router };
}
render() {
return this.props.children;
}
}
); |
Still having this issue in |
@batbayar-su could you please provide an example that reproduces the problem? Original issue was resolved and you need to elaborate what your setup is to ensure that your issue is the same. |
It worked with this modification. @ArnoSaine could you explain to me why it is necessary, please? |
@batbayar-su react-router-bootstrap <0.25 uses
|
I have this problem using react-router-bootstrap v0.25.0 and react-router-dom v5.1.2. My environment is from CRA and I do not know how to apply the workaround shown. How and where do I add that workaround? Any example code or instructions? Is there a substitute for react-router-bootstrap I could try? |
Update to my last above: After stopping work on my project due to this bug, I came back 2 days later and it works with no error. Does this mean it's a timing bug? And if I had restarted at the time it would have gone away? |
Uh oh!
There was an error while loading. Please reload this page.
Since react-router is in version 5.0.0, react-router-bootstrap is not working.
The following error occurred
LinkContainer.js:147 Uncaught TypeError: Cannot read property 'history' of undefined at LinkContainer.render (LinkContainer.js:147)
More information about this problem can be find here [(https://github.com/remix-run/react-router/issues/6630)]
for information :
The text was updated successfully, but these errors were encountered: