From 79af6287c1569140360f8faaea8bd021cfff5815 Mon Sep 17 00:00:00 2001
From: Jeonguiyeob <uiyeop@ajou.ac.kr>
Date: Thu, 30 Mar 2023 02:14:58 +0900
Subject: [PATCH] edit1

---
 src/App.js | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/App.js b/src/App.js
index 4cde872..a19d568 100755
--- a/src/App.js
+++ b/src/App.js
@@ -1,11 +1,39 @@
 import React, { Component } from 'react';
 
-const App = () => {
+const cityList = [
+  {cityName: "Seoul", timezone: "Asia/Seoul"},
+  {cityName: "London", timezone: "Europe/London"},
+  {cityName: "NewYork", timezone: "America/New_York"},
+];
+
+const TimeButton = (props) => {
+  let [time,setTime] = useState(null);
+  const displayTime = () => {
+    let date = new Date();
+    setTime(date.toLocaleString("ko-KR", { timeZone: props.tz }));
+  };
+
+  return (
+    <>
+    <button onClick={displayTime} tz={props.tz}>{props.name}</button>
+    <div id='time'>{time}</div>
+    </>
+  );
+}
+
+const App = (props) => {
+    let city = cityList.map((value => {
+      console.log(value.cityName);
+      return <TimeButton name={value.cityName} tz={value.timezone} />;
+    }));
+
     return (
+      <>
       <h1>
         What time is it?
       </h1>
+      </>
     );
 }
 
-export default App;
+export default App;
\ No newline at end of file
-- 
GitLab