Skip to content

Instantly share code, notes, and snippets.

@danbruegge
Created August 1, 2018 19:42
Show Gist options
  • Save danbruegge/514cf73337ce97a91bdbed6aa9ba93a4 to your computer and use it in GitHub Desktop.
Save danbruegge/514cf73337ce97a91bdbed6aa9ba93a4 to your computer and use it in GitHub Desktop.
PreloadImages.jsx
import React from 'react';
import PropTypes from 'prop-types';
const PreloadImages = ({ urls }) => urls.map(url => (
<span key={url} style={{ backgroundImage: `url(${url})` }} />
));
PreloadImages.propTypes = {
urls: PropTypes.arrayOf(PropTypes.string).isRequired,
};
export default PreloadImages;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment