Skip to content

Instantly share code, notes, and snippets.

@Killavus
Created September 2, 2016 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Killavus/094a0e63709575c0be8325677430f458 to your computer and use it in GitHub Desktop.
Save Killavus/094a0e63709575c0be8325677430f458 to your computer and use it in GitHub Desktop.
An example of orchestrating the service.
// In your initialize code:
import React from 'react';
import ReactDOM from 'react-dom';
import FetchData from './fetch-data'; // Your data-fetching service.
import Component from './component';
ReactDOM.render(<Component {...props} />, domElement,
function loadData() {
// this points to your component instance here.
FetchData().then(data => {
this.setState({ data });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment