-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.tsx
47 lines (41 loc) · 1.02 KB
/
page.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
'use client'
import styles from "./page.module.css";
import { useEffect, useState } from "react";
export default function Home() {
const [data, setData] = useState(null);
useEffect(() => {
(async () => {
try {
// View forwarded ports in VSCode to determine your port
const response = await fetch('http://localhost:62396/');
const jsonData = await response.json();
setData(jsonData.text);
} catch (error) {
console.error('Error fetching data:', error);
}
})();
}, []);
return (
<div className={styles.page}>
<main className={styles.main}>
<h1>
{data ? (
data
) : (
<p>Loading data...</p>
)}
</h1>
<label htmlFor="payment" className={styles.label}>
Payment amount
</label>
<input
type="text"
id="payment"
name="payment"
className={styles.input}
placeholder="Enter amount"
/>
</main>
</div>
);
}