Skip to content

Instantly share code, notes, and snippets.

@PorterK
Created February 13, 2019 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PorterK/b9b97782bf283d649b1bdcd3595efc2b to your computer and use it in GitHub Desktop.
Save PorterK/b9b97782bf283d649b1bdcd3595efc2b to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
const mobileImages = ['img1.png', 'img2.png', 'img3.png', 'img4.png', 'img5.png'];
const mediumImages = [...mobileImages, 'img6.png', 'img7.png'];
const desktopImages = [...mobileImages, ...desktopImages, 'img7.png', 'img8.png'];
export defualt class Images extends Component {
state = {
images: [],
};
propogateImages = async () => {
const { width } = this.props;
switch (width) {
case 'xs':
const promises = mobileImages.map(async (i) => await import(i));
const images = await Promise.map(promises);
this.setState({ images });
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment