Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SPP 2143 Learning Through Connecting
ltc_website
Commits
90e55346
Commit
90e55346
authored
Dec 04, 2019
by
amarcic
Browse files
changed class component to function component; testing hooks
parent
d2ef9da1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/index.js
View file @
90e55346
import
React
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
{
HelloComputerButton
}
from
'
./components/
'
;
import
'
./index.css
'
;
c
lass
App
extends
React
.
Component
{
render
()
{
return
(
<
div
>
<
span
>
Hello
World
<
/span><br /
>
<
HelloComputerButton
/>
<
/div
>
)
c
onst
INIT_LABELS
=
{
HelloWorld
:
{
de
:
"
Hallo ganze Welt
"
,
en
:
"
Hello World
"
},
HelloComputerButton
:
{
de
:
"
Achtung, Rechenmaschine!
"
,
en
:
"
Hello Computer
"
}
};
const
INIT_SETTINGS
=
{
language
:
"
en
"
}
ReactDOM
.
render
(
<
App
/>
,
document
.
getElementById
(
'
app
'
))
const
App
=
()
=>
{
const
[
labels
,
setLabels
]
=
useState
(
INIT_LABELS
);
const
[
settings
,
setSettings
]
=
useState
(
INIT_SETTINGS
);
return
(
<
div
>
<
span
>
{
labels
.
HelloWorld
[
settings
.
language
]}
<
/span><br /
>
<
HelloComputerButton
/>
<
/div
>
)
}
ReactDOM
.
render
(
<
App
/>
,
document
.
getElementById
(
'
app
'
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment