Comparing an array while mapping it to JSX elements

I have an array that looks like this one(it has more items inside of it, but the structure is the same):

 [
        {
            "users": [
"speciality": "surgery"
                {
                   "name": "John",
                   "location": "USA",
                    "age": "34",
                },
               {
                    "name": "John",
                   "location": "California",
                    "address": "Silk Road 123"
                },
               {
                   "name": "Jane",
                   "last-name": "Edmus"
                   "location": "USA"
                }
            ]
        },
    ]

I´m trying to map this array in such a way that, if the name property is equal in two objects, it should get mapped as only one p tag with many locations appearing behind a "see more “tag”. This is what I currently have, which doesn´t work:

  mapArray= () =>{
    const test= this.state.test;
     return test.map(i => 
       i.users.map((user,index) =>
       <div>
          <p>{i.speciality}</p>
{user.name[index] ===user.name[index + 1] ? <p>{user}</p> <p>See more></p> <p>{user.location}} : <p>{user}<p>{user.location}</p>
           </div>

I posted in your previous thread about a way of merging the objects together

You didn’t reply to that thread, was that not helpful?