Skip to content

Instantly share code, notes, and snippets.

View john1jan's full-sized avatar

John Francis john1jan

View GitHub Profile
@john1jan
john1jan / PChildComponent.js
Last active March 21, 2017 12:52
Passing Params Child Component
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")} />
@john1jan
john1jan / ChildConstructor.js
Created March 20, 2017 16:22
Child Contructor Binding
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>
@john1jan
john1jan / ChildBinding.js
Last active March 20, 2017 16:31
ChildBinding while method invocation
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")} />