Skip to content

Instantly share code, notes, and snippets.

@tocttou
Created March 27, 2017 13:33
Show Gist options
  • Save tocttou/447eed019c83a5be8793ac9d04117488 to your computer and use it in GitHub Desktop.
Save tocttou/447eed019c83a5be8793ac9d04117488 to your computer and use it in GitHub Desktop.
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