I have an array of objects like below -
const studentDetails = [
{id:1, name:"Mike", stream:"Science", status:"active"},
{id:2, name:"Kelly", stream:"Commerce", status:"inactive"},
{id:3, name:"Bob", stream:"Law", status:"inactive"},
]
What I want to do is map through the array and route to another page when the status is inactive.
studentDetails.map(studentDetail => {
if(studentDetail.status === 'inactive'){
router.push("/pageB")
}
})
My doubt here is that when we route to pageB when the id is 2, how will I continue the loop for id=3
Many Thanks
maploop?