Last active
November 19, 2018 08:36
-
-
Save anishtr4/b8ef69e73d32cfcb2e9eaf2de126a58a to your computer and use it in GitHub Desktop.
This file contains 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
import React, { Component } from "react"; | |
function ParentComponent(props) { | |
return ( | |
<ChildComponent value={props.value} /> | |
); | |
} | |
function ChildComponent(props) { | |
return ( | |
<GrandChildComponent value={props.value} /> | |
); | |
} | |
function GrandChildComponent(props) { | |
return ( | |
<div className="Component2"> <p>{props.value}</p></div> | |
); | |
} | |
class ProVal extends Component { | |
state = { | |
inputdata: 0 | |
}; | |
updateInputValue = (evt) => { | |
this.setState({ | |
inputdata: evt.target.value | |
}); | |
} | |
render() { | |
return ( | |
<div> | |
<ParentComponent value={this.state.inputdata} /> | |
<input value={this.state.inputdata} onChange={this.updateInputValue} /> | |
</div> | |
); | |
} | |
} | |
export default ProVal; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment