Array's of images
See original GitHub issueHello people,
Well, my problem is about images. imagine the problem, that in my div parent, only have tags img children or 1 or more than 1. And i put that img src’s on a array like:
– slider.json –
[
'./img/header.jpg',
'./img/header1.jpg'
]
And this is my React component:
import React, { Component } from 'react';
import * as data from "../resources/slider.json";
class FullWidthHeader extends Component{
render(){
return(
<Image />
);
}
}
class Image extends FullWidthHeader{
createImage(props){
return(<img src={props} alt="imgwow" />);
}
createImages(images){
return images.map(this.createImage);
}
render(){
return(
<div>
{ this.createImages(data) }
</div>
);
}
}
export default FullWidthHeader;
My problem i think, its for webpack seeing the img src, i cant see the image… How i can resolve this?
Kind Regards,
Pedro Cruz
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Showing an image from an array of images - Javascript
Just as Diodeus said, you're comparing an Image to a HTMLDomObject . Instead compare their .src attribute: var imgArray = new Array(); ...
Read more >Arrays and Array Images - Earth Engine - Google Developers
Array Images. Arrays in Earth Engine are constructed from lists of numbers and lists of lists. The degree of nesting determines the number ......
Read more >Pixels, Arrays, and Images. An Introduction to Computer Vision
Each cell of the array, corresponds to a pixel in the image. This means that the array's dimensions are equal to the resolution....
Read more >Arrays of Pictures
Reference through an array simplifies naming of the pictures. The image tags on the page are put in an array anyway. (Document.images[]). Mechanics:....
Read more >Create an Array of Images in JavaScript (Tutorial) - Maker's Aid
The simplest, most straightforward way to create an array of images is to declare an array object and push the URLs to your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
webpack isn’t able to analyze this, but the fix should be relatively simple.
Change
slider.json
toslider.js
, and replace entries like so:Change
to
It cannot be done with json unless if you use the public folder. Sorry!
I’ll close this as resolved, since you said the
js
solution works (and https://github.com/facebookincubator/create-react-app/issues/2545#issuecomment-309015448 for json).