Skip to content

Instantly share code, notes, and snippets.

@crypticminds
Last active July 12, 2020 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crypticminds/19ab5482588d5e7c23668423e1641392 to your computer and use it in GitHub Desktop.
Save crypticminds/19ab5482588d5e7c23668423e1641392 to your computer and use it in GitHub Desktop.
import React , {useState,lazy} from "react";
import Button from "./button";
const DialogBox = lazy(() => import("./dialogBox"));
const MyComponent = () => {
const [showDialogBox, setShowDialogBox] = useState(false);
return(
<div>
<React.Suspense fallback={"loading"} />
<DialogBox show={showDialogBox}/>
<React.Suspense/>
<Button onClick={() => setShowDialogBox(true)} />
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment