Skip to content

Instantly share code, notes, and snippets.

@charisTheo
Created August 21, 2021 19:12
Show Gist options
  • Select an option

  • Save charisTheo/7900f9082a252ca68651f8e5e06daacc to your computer and use it in GitHub Desktop.

Select an option

Save charisTheo/7900f9082a252ca68651f8e5e06daacc to your computer and use it in GitHub Desktop.
import React, { useState } from 'react'
const NavMenu = React.lazy(() => import('./NavMenu'))
function Header() {
const [showMenu, setShowMenu] = useState(false)
return (
<div>
<React.Suspense fallback={<p>Loading...</p>}>
{showMenu && <NavMenu />}
</React.Suspense>
</div>
)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment