Skip to content

Instantly share code, notes, and snippets.

View hzhu's full-sized avatar
🍵
building matcha.xyz

henryzhu.eth hzhu

🍵
building matcha.xyz
View GitHub Profile
@hzhu
hzhu / updating-external-data-when-props-changes-using-promises.js
Created October 25, 2018 02:48 — forked from bvaughn/updating-external-data-when-props-changes-using-promises.js
Example for loading new external data in response to updated props
// This is an example of how to fetch external data in response to updated props,
// If you are using an async mechanism that does not support cancellation (e.g. a Promise).
class ExampleComponent extends React.Component {
_currentId = null;
state = {
externalData: null
};