Skip to content

Instantly share code, notes, and snippets.

View IAMtheIAM's full-sized avatar

IAMtheIAM

  • Central Arizona, USA
View GitHub Profile
@IAMtheIAM
IAMtheIAM / javascript_loader.js
Last active January 12, 2017 18:10 — forked from hagenburger/javascript_loader.js
Dynamically load JavaScript files with callback when finished
// Example:
function myCallback() {
// cool stuff here
}
// don't invoke the function here with () i.e. myCallback(), just reference the name of it it - myCallback.
JavaScript.load("/javascripts/something.js", myCallback);
// With callback (that’s the good thing):
@IAMtheIAM
IAMtheIAM / dispatching-action-creators.js
Created December 4, 2018 20:25 — forked from markerikson/dispatching-action-creators.js
Dispatching action creators comparison
// approach 1: define action object in the component
this.props.dispatch({
type : "EDIT_ITEM_ATTRIBUTES",
payload : {
item : {itemID, itemType},
newAttributes : newValue,
}
});
// approach 2: use an action creator function