import React from "react";import { BrowserRouter as Router, Switch, Route, Link, useHistory, useLocation, useParams} from "react-router-dom";export default function ModalGalleryExample() { return ();}function ModalSwitch() { let location = useLocation(); let background = location.state && location.state.background; return (
} /> } /> } /> {/* Show the modal when a background page is set */} {background && } />}
);}const IMAGES = [ { id: 0, title: "Dark Orchid", color: "DarkOrchid" }, { id: 1, title: "Lime Green", color: "LimeGreen" }, { id: 2, title: "Tomato", color: "Tomato" }, { id: 3, title: "Seven Ate Nine", color: "#789" }, { id: 4, title: "Crimson", color: "Crimson" }];function Thumbnail({ color }) { return (
);}function Image({ color }) { return (
);}function Home() { return (
Visit the Gallery

Featured Images

  • Tomato
  • Crimson
);}function Gallery() { let location = useLocation(); return (
{IMAGES.map(i => (

{i.title}

))}
);}function ImageView() { let { id } = useParams(); let image = IMAGES[parseInt(id, 10)]; if (!image) return
Image not found
; return (

{image.title}

);}function Modal() { let history = useHistory(); let { id } = useParams(); let image = IMAGES[parseInt(id, 10)]; if (!image) return null; let back = e => { e.stopPropagation(); history.goBack(); }; return (

{image.title}

);}