I have a project in react, it works well in the development version, but when I export it (bundle.js) and I take it to a tomcat it does not recognize the routes of the react-router-dom.
Do I need to configure something in the tomcat? I found several examples but they have not worked for me:
react routing is able to handle different url path but tomcat returns 404 not available resources
https://github.com/gildata/RAIO/issues/138
This is my index.jsx:
import React from 'react';
import { render } from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import { IntlProvider } from 'react-intl';
import { Provider } from 'react-redux';
import store from 'src/app/store';
import App from 'src/app/App';
render(
<Provider store={store}>
<IntlProvider locale="en">
<BrowserRouter>
<App />
</BrowserRouter>
</IntlProvider>
</Provider>,
document.getElementById('contenedor'),
);
This is App.jsx
import React from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import Login from 'src/app/Login';
import Menu from 'src/app/Menu';
const logueado = localStorage.getItem('tLogueado');
const App = () => (
<main>
<Switch>
<Route exact path="/login" render={() => (logueado ? (<Redirect to="/onix" />) : (<Login />))} />
<Route exact path="/onix" render={() => (logueado ? (<Menu />) : (<Redirect to="/login" />))} />
</Switch>
</main>
);
export default App;
I am doing something wrong? please have me patience i am new in react.