Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple gallery in React & Typescript, where images are loaded dynamically from an external list
import React, { Dispatch, SyntheticEvent } from "react";
function Button({ text, onClick }: { text: string; onClick: any }) {
return <button onClick={onClick}>{text}</button>;
}
export default Button;
const images = [
{
url: "20_02.jpg",
caption: "Pier",
alt: "Pier",
},
{
url: "20_05.jpg",
caption: "Solitary tree",
alt: "Tree",
},
{
url: "20_07.jpg",
caption: "Sausage dog",
alt: "Sausage dog",
},
{
url: "20_17.jpg",
caption: "Daffodils",
alt: "Daffodils",
},
{
url: "20_21.jpg",
caption: "Branches and flowers",
alt: "Branches and flowers",
},
];
export default images;
export const count = images.length;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.