Skip to content

Instantly share code, notes, and snippets.

@goughjo02
Created February 25, 2019 14:27
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 goughjo02/b84ffd23d722a35b6895f0c2a9f6dd2e to your computer and use it in GitHub Desktop.
Save goughjo02/b84ffd23d722a35b6895f0c2a9f6dd2e to your computer and use it in GitHub Desktop.
import React from "react";
export default class LazilyLoadedCustomFeature extends Component {
state = {
content: null
};
componentDidMount() {
import(pathtofile).then(e => {
this.setState({ content: e });
});
}
render() {
const { content } = this.state;
return content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment