I have a few collections of data that are in JSON format and want to access specific data conditional data, an example I want to access which one has teacher:true and put it in a state. I have tried it with conditions inside the loop and filter function.
[
0:{name:"Rou",id:"121"}
1:{name:"Sou",id:"122",teacher:"true"}
2:{name:"Tou",id:"123"}
3:{name:"Vou",id:"124",teacher:"true"}
4:{name:"Kou",id:"125",teacher:"false"}
5:{name:"Wou",id:"126"}
]
here I want to get only
1:{name:"Sou",id:"122",teacher:"true"}
3:{name:"Vou",id:"124",teacher:"true"}
which means only where the teacher is true.