Skip to content

Instantly share code, notes, and snippets.

@happylinks
Created March 10, 2017 13:49
Show Gist options
  • Select an option

  • Save happylinks/8110e3adca0f4ff6d23baee5dfdd1c4e to your computer and use it in GitHub Desktop.

Select an option

Save happylinks/8110e3adca0f4ff6d23baee5dfdd1c4e to your computer and use it in GitHub Desktop.
async component compare
// https://github.com/ctrlplusb/react-async-component
const AsyncProduct = createAsyncComponent({
resolve: () => import('./MyComponent'),
Loading: MyLoadingComponent,
// No error component
// No delay
ssrMode: 'render', // default
});
vs
// https://github.com/thejameskyle/react-loadable
const LoadableMyComponent = Loadable(
() => import('./MyComponent'),
MyLoadingComponent,
MyErrorComponent,
200, // delay
path.join(__dirname, './MyComponent') // ssr path
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment