MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / DataProvider

Class DataProvider

code/composition/src/app.jsx:10–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8const Title = () => <h1>Hello there!</h1>;
9
10class DataProvider extends React.Component {
11 constructor(props) {
12 super(props);
13
14 this.state = { data: null };
15 setTimeout(() => this.setState({ data: 'Hey there!' }), 5000);
16 }
17 render() {
18 if (this.state.data === null) return null;
19 return <section>{ this.props.render(this.state.data) }</section>;
20 }
21}
22DataProvider.propTypes = {
23 render: PropTypes.func
24};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected