Skip to content

Instantly share code, notes, and snippets.

@nitayneeman
Created January 10, 2021 20:46
Show Gist options
  • Save nitayneeman/8b7656ae984f10d4a8be25ae6d09a9f7 to your computer and use it in GitHub Desktop.
Save nitayneeman/8b7656ae984f10d4a8be25ae6d09a9f7 to your computer and use it in GitHub Desktop.
const FirstComponent = React.lazy(() => import('./FirstComponent.client.js'));
const SecondComponent = React.lazy(() => import('./SecondComponent.client.js'));
function MyClientComponent(props) {
const shouldDisplaySecondComponent = ...; // Some logic
return shouldDisplaySecondComponent ? <SecondComponent/> : <FirstComponent/>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment