This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChildComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { message: 'I am Child ' }; | |
} | |
render() { | |
return <div> | |
<p> Child Component</p> | |
<input type="button" value="Print From Child Bind" onClick={this.props.printParent.bind(this, "Mars")} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChildComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { message: 'I am Child ' }; | |
this.printChild = this.printChild.bind(this); | |
} | |
render() { | |
return <div> | |
<p> Child Component</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChildComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { message: 'I am Child ' }; | |
} | |
render() { | |
return <div> | |
<p> Child Component</p> | |
<input type="button" value="Print From Child" onClick={this.props.printParent("Mars")} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { message: 'I am parent ' }; | |
this.printParent = this.printParent.bind(this); | |
} | |
render() { | |
return <div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { message: 'Hello ' }; | |
this.print= this.print.bind(this); | |
} | |
render() { | |
return <div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { message: 'Hello World' }; | |
this.print = this.print.bind(this); | |
} | |
render() { | |
return <div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class App extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { message: 'Hello World' }; | |
} | |
render() { | |
return <div> | |
<p> Binding Revealed</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Sample = React.createClass({ | |
printMars(message) { | |
console.log("Hello " + message); | |
}, | |
render() { | |
return ( | |
<div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Sample = React.createClass({ | |
getInitialState() { | |
return { | |
message: "Hello World" | |
} | |
}, | |
print() { | |
console.log(this.state.message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Sample1 = React.createClass({ | |
print(message) { | |
console.log("Hello " + message); | |
}, | |
render() { | |
return ( | |
<input type="button" value="Print" onClick={this.print("Mars")} /> | |
); |
NewerOlder