I have developed simple application in react with 2 components i.e Category and Transport . i wanted to load these components using react-dom-routes whihch i am able to do so when application is deployed on node server . But when I productionized the application and depployed in the tomcat it is not working . I have also added web.xml with below configuration in my War . Can someone please help or let me know if I am missing anything .
On Node server I able to access component using below URL http://localhost:3000/category http://localhost:3000/transport
I wanted to access the component in similar way on tomcat.
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
reportWebVitals();
App.js
import './App.css';
import {BrowserRouter, Routes, Route } from "react-router-dom";
import Transport from "./Components/Transport";
import Category from "./Components/Category";
function App() {
return (
<div className="App">
<BrowserRouter>
<Routes>
<Route index element={<Category/>}/>
<Route path="category" element={<Category/>}/>
<Route path="transport" element={<Transport/>}/>
</Routes>
</BrowserRouter>
</div>
);
}
export default App;
Web.xml
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?><web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" metadata-complete="false" version="3.1" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<display-name>React App </display-name>
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>
</web-app>