Skip to content

Instantly share code, notes, and snippets.

@olahbold
Created April 28, 2021 10:50
Show Gist options
  • Select an option

  • Save olahbold/b6f8423dc84eb5e0393d7bf8d1eacdff to your computer and use it in GitHub Desktop.

Select an option

Save olahbold/b6f8423dc84eb5e0393d7bf8d1eacdff to your computer and use it in GitHub Desktop.
Images GAllery
I am trying to load multiple images in react using Map function.
xport default function ProjectGallery(props){
return (
<Row>
<Col>
Carousel>
<Carousel.Item>
<img
className="d-block w-100"
src={`/testimonials/icon/${props.image}`}
alt="First slide"
/>
<Carousel.Caption>
<h3>First slide label</h3>
<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
</Carousel.Caption>
</Carousel.Item>
</Carousel>
export default function ProjectUpdater() {
const {projectLocation} = useParams();
return (
<div>
{ProjectData
.filter((data) => data.projectLocation === projectLocation)
.map((data) => (
<ProjectGallery key={data.id} title ={data.projectLocation} image = {data.ProjectImages} />
))}
</div>
)
}
const ProjectData = [
{
id: 1,
projectLocation: "CBN",
ProjectImages: ["avatar.jpg"],
url: "projects/cbn",
},
{
id: 2,
projectLocation: "gusape",
ProjectImages: ["installation1.jpg", "installation3.jpg"],
url: "projects/gusape",
},
];
export default ProjectData;
The Images are not showing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment