test spa with react

This commit is contained in:
Geir Okkenhaug Jerstad 2024-09-25 14:42:53 +02:00
parent adfb0f4065
commit 3648937eac
4 changed files with 103 additions and 22 deletions

View file

@ -0,0 +1,41 @@
import React, { Component } from "react";
class About extends Component {
render() {
return (
<div>
<h3>SPA App - About</h3>
<p>This is a paragraph on the About of the SPA App.</p>
<p>The Team of SPA App.</p>
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>John Doe</td>
<td>johndoe@example.com</td>
</tr>
<tr>
<td>2</td>
<td>Jane Doe</td>
<td>janedoe@example.com</td>
</tr>
<tr>
<td>3</td>
<td>Bob Smith</td>
<td>bobsmith@example.com</td>
</tr>
</tbody>
</table>
</div>
);
}
}
export default About;

View file

@ -1,25 +1,32 @@
import logo from './logo.svg'; import React, { Component } from "react";
import './App.css'; import { Route, NavLink, HashRouter, Routes } from "react-router-dom";
function App() { import Home from "./Home";
return ( import About from "./About";
<div className="App"> import Contact from "./Contact";
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" /> class App extends Component {
<p> render() {
Edit <code>src/App.js</code> and save to reload. return (
</p> <HashRouter>
<a <div className="App">
className="App-link" <h1>A Simple SPA made using React</h1>
href="https://reactjs.org" <ul className="header">
target="_blank" <li><NavLink to="/">Home</NavLink></li>
rel="noopener noreferrer" <li><NavLink to="/about">About</NavLink></li>
> <li><NavLink to="/contact">Contact</NavLink></li>
Learn React </ul>
</a> <div className="content">
</header> <Routes>
</div> <Route exact path="/" element={<Home />}></Route>
); <Route path="/about" element={<About />}></Route>
<Route path="/contact" element={<Contact />}></Route>
</Routes>
</div>
</div>
</HashRouter>
);
}
} }
export default App; export default App;

View file

@ -0,0 +1,20 @@
import React, { Component } from "react";
class Contact extends Component {
render() {
return (
<div>
<h3>SPA App - Contact</h3>
<p>Please feel free to contact us with any questions or inquiries you may have. We are always happy to help!</p>
<h4>Contact Details:</h4>
<ul>
<li><strong>Email:</strong> info@example.com</li>
<li><strong>Phone:</strong> 1-800-555-1234</li>
<li><strong>Address:</strong> 123 Main St, Anytown USA</li>
</ul>
</div>
);
}
}
export default Contact;

View file

@ -0,0 +1,13 @@
import React, { Component } from "react";
class Home extends Component {
render() {
return (
<div>
<h3>SPA App - Home</h3>
<p>This is a paragraph on the HomePAge of the SPA App.</p>
</div>
);
}
}
export default Home;