-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.jsx
55 lines (44 loc) · 1.27 KB
/
script.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
console.log("Inside script.js");
var AppContainer = React.createClass({
getInitialState: function() {
return null;
},
uiReceived: function() {
console.log("user input received");
this.renderedMD.foo();
},
render: function() {
return (
<div className="maincontainer">
<div className="editor">
<UserInput ref={(input) => this.userInput = input} cbParent={this.uiReceived}></UserInput>
</div>
<RenderedMD ref={(md) => this.renderedMD = md} ></RenderedMD>
</div>
)
}
});
var UserInput = React.createClass({
handleInput: function(e) {
this.props.cbParent();
},
render: function() {
return (<textarea onChange={this.handleInput}></textarea>)
}
})
var RenderedMD = React.createClass({
getInitialState: function() {
return {displayData: "Update the text to the right to preview the rendered Markdown"}
},
foo: function() {
console.log("bar");
},
render: function() {
return (
<div className="preview">{this.state.displayData}</div>
)
}
});
ReactDOM.render(
<AppContainer />,
document.getElementById("app"));