I'm using the react-rails gem (v 2.3) with react-router-dom (v 4.2.2) and mounting my root component App on my root Rails route.
This is how it's being mounted:
<%= react_component("App") %>
And this is the component itself:
const Router = ReactRouterDOM.BrowserRouter,
Route = ReactRouterDOM.Route;
class App extends React.Component{
render() {
return (
<Router>
<Route path="/" component={Index}>
</Route>
</Router>
);
}
}
I keep getting the following error:
Uncaught Error: You should not use <Route> or withRouter() outside a <Router>
Am I not using the Route component within a Router component above? Is there an error perhaps with the Index component?
Thanks in advance for any help :)