Why map() function doesn't work in my react app?
Solution 1:
your not returning from the map() function. This should solve it:
<div className="wrapper">
{sliderItems.map((item)=> ( <div className="slide">
<div className="img_container">
<img src={item.img}/>
</div>
<div className="info_container">
<h1>{item.title}</h1>
<p>{item.desc}</p>
<button>Button</button>
</div>
</div>)
)}
</div>
Solution 2:
It seems you didn't return your elements from map
. Try this:
<div className="wrapper">
{sliderItems.map((item)=>(
<div className="slide">
<div className="img_container">
<img src={item.img}/>
</div>
<div className="info_container">
<h1>{item.title}</h1>
<p>{item.desc}</p>
<button>Button</button>
</div>
</div>
))}
</div>