Skip to content

Instantly share code, notes, and snippets.

@notgiorgi
Last active July 12, 2017 14:17
Show Gist options
  • Select an option

  • Save notgiorgi/e2007e0b080f3e61e2e88c106a41af70 to your computer and use it in GitHub Desktop.

Select an option

Save notgiorgi/e2007e0b080f3e61e2e88c106a41af70 to your computer and use it in GitHub Desktop.
// ./src/features/Posts/index.js
// instead of directly exporting, we export wrapped
export default withLazyLoading(
() => import(/* webpackChunkName: "Post" */ './components/Post'),
<Loading type="spinner" />
)
// ./src/views/News/index.jsx
import Post from '...'
/* ... */
class News extends React.Component {
/* ... */
render() {
/* ... */
<Post
title={'Foobar'}
{...}
/>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment