- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreactStatefulAndPresentationalComponents.html
More file actions
Latest commit
49 lines (42 loc) · 1.55 KB
/
Copy pathreactStatefulAndPresentationalComponents.html
File metadata and controls
49 lines (42 loc) · 1.55 KB
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>
<metacharset="utf-8">
<metahttp-equiv="x-ua-compatible" content="ie=edge">
<metaname="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<divid="root"></div>
<scriptcrossoriginsrc="https://unpkg.com/react@16/umd/react.development.js"></script>
<scriptcrossoriginsrc="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<scriptcrossoriginsrc="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui-react/0.82.4/semantic-ui-react.min.js"></script>
<linkrel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.3/semantic.min.css"></link>
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.21.1/babel.min.js"></script>
<scripttype="text/babel">
classStatefulComponentextendsReact.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.ButtononClick={()=>this.changeUsername("felix")}>Nutzer zu Felix machen</semanticUIReact.Button>
</div>
);
}
}
constpresentationalComponent=(props)=>{
return(<p>Hallo {props.string}</p>)
};
ReactDOM.render(
<SidebarExampleSidebar/>,
document.getElementById('root')
);
</script>
</body>
</html>