0

sorry to ask simple question, since i'am still new with programming. bellow the data that i get from the Api, and i store it to the state.data[]. the problem is i don't know how to sort data to display only object if cooUUID is equal to "aaaa" and get coopName data from that.

Data": [
        {
            "coopUUID": "aaaaaa",
            "coopName": "Koperasi Energi Terbarukan Indonesia (KOPETINDO)",

        },
        {
            "coopUUID": "bbbbb",
            "coopName": "Induk Koperasi Pegawai Republik Indonesia (IKP-RI)",

        },
        {
            "coopUUID": "cccccc",
            "coopName": "KOPERASI STEBANK",
        }

  constructor(props){
        super(props);
        this.state={
            data: [],
        }

2 Answers 2

4

Try

let filter = data.filter(item => item.coopUUID === "aaaa").map(item => item.coopName);
Sign up to request clarification or add additional context in comments.

1 Comment

Glad to help you :)
-1

you should try this one

var found = Data.filter(function(item) {
    return item.coopUUID== aaaaaa
  })

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.