I'm trying to have a React Slick but when I map the images they are not displaying correctly.
I saw that some people uses Require()
statement but when I use it I have a blank page.
This is my component with images:
export const urlImagenes = [
{
alt: 'BUENOS-AIRES-CIUDAD',
url: "../../assets/images/PARTNERS_0000_BUENOS-AIRES-CIUDAD.jpg"
},
{
alt: 'CABLEVISION',
url: "../../assets/images/PARTNERS_0002_CABLEVISIÓN.jpg"
},
{
alt: 'PREFECTURA-NAVAL',
url: "../../assets/images/PARTNERS_0003_PREFECTURA-NAVAL.jpg"
},
....
]
And here I map
them
return (
<div className="partners-container container">
<h2>Partners</h2>
<p>
Multiradio posee acuerdos estratégicos con compañías internacionales
de primer nivel, garantizando así, el éxito en cada uno de los
proyectos desarrollados.
</p>
<div>
<Slider {...settings}>
{
urlImagenes.map((item, index) => {
return <div key={index}>
<img className="img-fluid" alt={item.alt} src={item.url}></img>
</div>
})
}
</Slider>
</div>
</div>
);
I tried with Require() like this:
Firstly: changing the url in the Images components:
export const urlImagenes = [
{
alt: 'BUENOS-AIRES-CIUDAD',
url: "PARTNERS_0000_BUENOS-AIRES-CIUDAD.jpg"
},
{
alt: 'CABLEVISION',
url: "PARTNERS_0002_CABLEVISIÓN.jpg"
},
{
alt: 'PREFECTURA-NAVAL',
url: "PARTNERS_0003_PREFECTURA-NAVAL.jpg"
},
....
]
Second: changing the map
:
urlImagenes.map((item, index) => {
return <div key={index}>
<img className="img-fluid" alt={item.alt} src={Require('../../assets/images/' + item.url ´'.jpg')}></img>
</div>
})
But doing this way I only have a Blank page...
Can anyone help me?