Created
February 13, 2019 15:42
-
-
Save PorterK/b9b97782bf283d649b1bdcd3595efc2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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