Skip to content

Instantly share code, notes, and snippets.

@faceyspacey
Created July 26, 2017 08:15
Show Gist options
  • Select an option

  • Save faceyspacey/3f7b778123a79ca339d181f5fdaab427 to your computer and use it in GitHub Desktop.

Select an option

Save faceyspacey/3f7b778123a79ca339d181f5fdaab427 to your computer and use it in GitHub Desktop.
hash-based universal component (the old way)
const components = {
Home: universal(() => import('./Home'), {
resolve: () => require.resolveWeak('./Home'),
}),
List: universal(() => import('./List'), {
resolve: () => require.resolveWeak('./List'),
}),
Video: universal(() => import('./Video'), {
resolve: () => require.resolveWeak('./Video'),
}),
}
const UniversalComponent = ({ page }) => {
const Component = components[page]
return <Component />
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment