-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.jsx
86 lines (75 loc) · 1.48 KB
/
App.jsx
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import React from 'react';
import ReactDom from 'react-dom';
var helpers = require('./helpers.js');
export default App;
class App extends React.Component {
render() {
return (
<div>
<Header/>
<Content/>
</div>
);
}
}
class Header extends React.Component {
render() {
return (
<div>
<h1>Recipe Sharing</h1>
</div>
);
}
}
class Content extends React.Component {
constructor(props) {
super(props);
this.state = {
backend: 'None',
usages: 0
}
this.selectCsharp = this.selectCsharp.bind(this);
this.selectJava = this.selectJava.bind(this);
this.selectRuby = this.selectRuby.bind(this);
}
selectCsharp() {
var _this = this;
_this.setState({
backend: 'C-Sharp',
message: "Connection Not Yet Implemented"
})
}
selectJava() {
var _this = this;
this.serverRequest =
helpers.getJavaConnection()
.then(function(result) {
_this.setState({
backend: 'Java',
message: 'Called ' + result.java.count + ' Times'
});
})
}
selectRuby() {
var _this = this;
_this.setState({
backend: 'Ruby',
message: 'Connection Not Yet Implemented'
})
}
render() {
return (
<div>
<button onClick = {() =>
this.selectCsharp()}>C#</button>
<button onClick = {() =>
this.selectJava()}>Java</button>
<button onClick = {() =>
this.selectRuby()}>Ruby</button>
<h2>Backend Selected: {this.state.backend}</h2>
<h2>{this.state.message}</h2>
</div>
);
}
}
export default App;