In my App.js, I'm trying to make available the this.props.history from the 'react-router-dom'.
Relavant code is App.js is:
import {BrowserRouter, Route, Switch, withRouter} from 'react-router-dom';
class App extends Component {
render() {
return (
<BrowserRouter>
<Switch>
<Route path="/login" exact component={Login}/>
<Route path="/" component={MainApp}/>
</Switch>
</BrowserRouter>
);
}
}
const appWithAuth = withRouter(App);
export default <BrowserRouter><appWithAuth/></BrowserRouter>;
Then I get the error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
And the error points to index.js:
> 22 | ReactDOM.render(
23 | <Provider store={store}><App/></Provider>
24 | , document.getElementById('root'));
25 | registerServiceWorker();
I researched this error but it seems very specific to individual problems. I did try to run npm install react-router-redux@next, but it didn't help.
Thanks in advance!