Commit 90e55346 authored by amarcic's avatar amarcic
Browse files

changed class component to function component; testing hooks

parent d2ef9da1
import React from 'react';
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import { HelloComputerButton } from './components/';
import './index.css';
class App extends React.Component{
render(){
return(
<div>
<span>Hello World</span><br />
<HelloComputerButton />
</div>
)
const 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' ))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment