Created
March 27, 2017 13:33
-
-
Save tocttou/447eed019c83a5be8793ac9d04117488 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'; | |
import FirstChild from './FirstChild'; | |
import SecondChild from './SecondChild'; | |
export default class Parent extends Component { | |
constructor(props, context) { | |
super(props, context); | |
this.state = { | |
text: Math.random() | |
}; | |
} | |
componentDidMount() { | |
setInterval(() => this.setState({ text: Math.random() }), 1000); | |
} | |
render() { | |
return ( | |
<div> | |
<FirstChild | |
text={this.state.text} | |
/> | |
<SecondChild | |
text="some random data" | |
/> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment