main
|
Last change
on this file since a3ae097 was a3ae097, checked in by Dimitar Arsov <dimitararsov04@…>, 6 months ago |
|
add Global exception handler
|
-
Property mode
set to
100644
|
|
File size:
834 bytes
|
| Line | |
|---|
| 1 | import { useEffect } from "react";
|
|---|
| 2 | import { BrowserRouter, Routes, Route } from "react-router-dom";
|
|---|
| 3 | import AllUsers from "./components/userProfile/AllUsersHelper";
|
|---|
| 4 | import UserDetail from "./components/userProfile/UserDetailView";
|
|---|
| 5 |
|
|---|
| 6 | function Home() {
|
|---|
| 7 | useEffect(() => {
|
|---|
| 8 | const fetchData = async () => {
|
|---|
| 9 | const response = await fetch("http://localhost:8080/");
|
|---|
| 10 | const data = await response.json();
|
|---|
| 11 | console.log(data);
|
|---|
| 12 | };
|
|---|
| 13 | fetchData();
|
|---|
| 14 | });
|
|---|
| 15 |
|
|---|
| 16 | return (
|
|---|
| 17 | <>
|
|---|
| 18 | <p className="text-red-500">ok</p>
|
|---|
| 19 | </>
|
|---|
| 20 | );
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | function App() {
|
|---|
| 24 | return (
|
|---|
| 25 | <BrowserRouter>
|
|---|
| 26 | <Routes>
|
|---|
| 27 | <Route path="/" element={<Home />} />
|
|---|
| 28 | <Route path="/users" element={<AllUsers />} />
|
|---|
| 29 | <Route path="/users/:userId" element={<UserDetail />} />
|
|---|
| 30 | </Routes>
|
|---|
| 31 | </BrowserRouter>
|
|---|
| 32 | );
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | export default App;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.