Skip to content

Instantly share code, notes, and snippets.

@MariaSzubski
Created June 6, 2018 15:35
Show Gist options
  • Save MariaSzubski/ab37948350e08740512a8fcc5fcaed3c to your computer and use it in GitHub Desktop.
Save MariaSzubski/ab37948350e08740512a8fcc5fcaed3c to your computer and use it in GitHub Desktop.
React - Using an object to set multiple img properties
const pics = {
panda: "http://bit.ly/1Tqltv5",
owl: "http://bit.ly/1XGtkM3",
owlCat: "http://bit.ly/1Upbczi"
};
const panda = (
<img
src={pics.panda}
alt="Lazy Panda" />
);
const owl = (
<img
src={pics.owl}
alt="Unimpressed Owl" />
);
const owlCat = (
<img
src={pics.owlCat}
alt="Ghastly Abomination" />
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment