-
Notifications
You must be signed in to change notification settings - Fork 0
/
reactStatefulAndPresentationalComponents.html
49 lines (42 loc) · 1.55 KB
/
reactStatefulAndPresentationalComponents.html
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
48
49
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div id="root"></div>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui-react/0.82.4/semantic-ui-react.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.3/semantic.min.css"></link>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.21.1/babel.min.js"></script>
<script type="text/babel">
class StatefulComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
username: "tom"
}
}
changeUsername = newUser => (this.setState({username: newUser}));
render() {
return (
<div>
<p>Hello {this.state.username}</p>
<semanticUIReact.Button onClick={() => this.changeUsername("felix")}>Nutzer zu Felix machen</semanticUIReact.Button>
</div>
);
}
}
const presentationalComponent = (props) => {
return (<p>Hallo {props.string}</p>)
};
ReactDOM.render(
<SidebarExampleSidebar />,
document.getElementById('root')
);
</script>
</body>
</html>