Skip to content

Instantly share code, notes, and snippets.

@adamdriscoll
Created September 7, 2019 16:32
Show Gist options
  • Save adamdriscoll/8a997c9f269bfb6b35ea6c2564008513 to your computer and use it in GitHub Desktop.
Save adamdriscoll/8a997c9f269bfb6b35ea6c2564008513 to your computer and use it in GitHub Desktop.
Lazy Element componentWillMount function from Universal Dashboard
componentWillMount() {
var script = document.createElement('script');
script.onload = function() {
this.setState({loading:false});
}.bind(this)
script.src = getApiPath() + "/" + this.props.component.assetId;
document.head.appendChild(script);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment