I have a javascript array like this:
const IMGS = [{
id: 0,
path: "../img/a1.jpeg",
},
{
id: 1,
path: "../img/a1-01.jpeg",
},
{
id: 2,
path: "../img/a1-02.jpeg",
},
{
id: 3,
path: "../img/a1-03.jpeg",
}
]
export default IMGS;
There are more images I am just showing few of them,
I need to show all the images in react from this array. The condition is the image_id should be >=18 but <30. How can I achieve that?
(I need to know the syntax).
I know I can do it using filter or map function, actually I'm new to javascript coming from c++, python background. It looks bit confusing to me. Please help!
This is my react code where I'm rendering it
<React.Fragment>
<Jumbotron>
<img src={background} alt="Not loading" id="jumbotron-image" className="img-fluid"/>
</Jumbotron>
<div className="container">
<div className="row">
<h1>Trending</h1>
</div>
<div className="row">
{/*images go here*/}
</div>
</div>
</React.Fragment>