How to preload images in React.js? I have dropdown select component which works like menu , but i have to preload image icons for items,because sometimes they are not visib
Assuming you have an images array containing data for each image, can do it in a one-liner
images
componentDidMount() { this.props.images.forEach(image => (new Image().src = image.src)); }