I have this array, I wish to pick out all the names which have a URL which contains '/blekinge'.
Any way to do this with map? And present in a list? I've come this far:
const allaOrter = orter.map((allOrt) =>
<li>{allOrt.url}</li>
)
What I would like to do is to have sort of an ifstatement or a forEach loop that picks out all the URLs which contains /blekinge and present those. But I dont know how... The real array I'm working with is much bigger and contains loads of urls. Maybe even make new arrays which contains those elements that have a common url. I hope my provided example is enough for someone of you guys to help me out. :)
orter.json
[{
"id": "2",
"namn": "Blekinge",
"url": "/blekinge"
},
{
"id": "23",
"namn": "Karlshamn",
"url": "/blekinge/karlshamn"
},
{
"id": "24",
"namn": "Karlskrona",
"url": "/blekinge/karlskrona"
},
{
"id": "25",
"namn": "Olofström",
"url": "/blekinge/olofstrom"
},
{
"id": "26",
"namn": "Ronneby",
"url": "/blekinge/ronneby"
}]