Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
firstReact
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jeong ui yeop
firstReact
Commits
02e8ee34
Commit
02e8ee34
authored
2 years ago
by
Jeong ui yeop
Browse files
Options
Downloads
Patches
Plain Diff
edit1
parent
79af6287
No related branches found
No related tags found
No related merge requests found
Pipeline
#6307
canceled
2 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/App.js
+26
-24
26 additions, 24 deletions
src/App.js
with
26 additions
and
24 deletions
src/App.js
+
26
−
24
View file @
02e8ee34
import
React
,
{
Component
}
from
'
react
'
;
const
cityList
=
[
{
cityName
:
"
Seoul
"
,
timezone
:
"
Asia/Seoul
"
},
{
cityName
:
"
London
"
,
timezone
:
"
Europe/London
"
},
{
cityName
:
"
NewYork
"
,
timezone
:
"
America/New_York
"
},
];
import
React
,
{
Component
,
useState
}
from
"
react
"
;
const
TimeButton
=
(
props
)
=>
{
let
[
time
,
setTime
]
=
useState
(
null
);
const
displayTime
=
()
=>
{
let
date
=
new
Date
();
setTime
(
date
.
toLocaleString
(
"
ko-KR
"
,
{
timeZone
:
props
.
tz
}));
...
...
@@ -15,25 +10,32 @@ const TimeButton = (props) => {
return
(
<>
<
button
onClick
=
{
displayTime
}
tz
=
{
props
.
tz
}
>
{
props
.
name
}
<
/button
>
<
div
id
=
'
time
'
>
{
time
}
<
/div
>
<
button
onClick
=
{
displayTime
}
tz
=
{
props
.
tz
}
>
{
props
.
cn
}
<
/button
>
<
div
id
=
"
time
"
>
{
time
}
<
/div
>
<
/
>
);
}
}
;
const
App
=
(
props
)
=>
{
let
city
=
cityList
.
map
((
value
=>
{
var
cityList
=
[
{
cityName
:
"
Seoul
"
,
timezone
:
"
Asia/Seoul
"
},
{
cityName
:
"
New_York
"
,
timezone
:
"
America/New_York
"
},
{
cityName
:
"
Tokyo
"
,
timezone
:
"
Asia/Tokyo
"
},
];
let
city
=
cityList
.
map
((
value
)
=>
{
console
.
log
(
value
.
cityName
);
return
<
TimeButton
n
ame
=
{
value
.
cityName
}
tz
=
{
value
.
timezone
}
/>
;
})
)
;
return
<
TimeButton
c
n
=
{
value
.
cityName
}
tz
=
{
value
.
timezone
}
/>
;
});
return
(
<>
<
h1
>
What
time
is
it
?
<
/h1
>
<
h1
>
What
time
is
it
?
<
/h1
>
<
div
>
{
city
}
<
/div
>
<
/
>
);
}
}
;
export
default
App
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment