We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6e298e0 commit d87dca3Copy full SHA for d87dca3
1 file changed
src/App.js
@@ -1,19 +1,23 @@
1
import React, {Component} from 'react';
2
+import Child from './Child';
3
4
class App extends Component{
5
constructor(props){
6
super(props);
7
8
this.state = {
- A: "A"
9
- }
+ parentValue: 100
10
+ };
11
+ }
12
+
13
+ addValueParent(value){
14
+ const newValue = this.state.parentValue + value;
15
+ this.setState({parentValue: newValue});
16
}
17
18
render(){
19
return(
- <div>
- <p>{this.state.A}</p>
- </div>
20
+ <Child pval={this.state.parentValue} add={this.addValueParent.bind(this)}></Child>
21
)
22
23
0 commit comments