Stack Exchange
React error index.js:1452 Warning: Each child in an array or iterator should have a unique "key" prop
I am trying to iterate through a store using Mobx in React. Here is my contact.jsx.
import React, { Component } from 'react';
import Navbar from '../components/Navbar';
import Footer from '../components/Footer';
import Jumbotron from '../components/Jumbotron';
import {inject, observer} from 'mobx-react';

@inject('MemberStore')
@observer

class Contact extends Component {
 handleSubmit = (e) => {
    e.preventDefault();

    const member = this.member.value;
    const email = this.email.value;
    // const email = this.email.value;
    this.props.MemberStore.addMember({member, email});
    this.member.value = '';
    this.email.value = '';
}
render() {
    const {MemberStore} = this.props;

    return (
        <div>
            <Navbar />
            <Jumbotron title="Contact Page" subtitle="You want to get in touch"/>
            <div className="container">
               <h2>You have {MemberStore.memberCount} members.</h2>

               <form onSubmit={e => this.handleSubmit(e)}>
                   <input type="text" placeholder="Enter Your Name" ref={input => this.member = input }/>
                   <div>
                   <input type="text" placeholder= "Enter Your Email" ref={input => this.email = input }/>
                   </div>
                   <button>Submit</button>
               </form>
               <ul>
                {MemberStore.members.map(({member, email}) => (
                    <li key={member}>
                        {member}
                        {email}
                    </li>
                ))}
                </ul>
            </div>
            <Footer />
        </div>
    )
  }
 }   

export default Contact;
Now it is only returning the email and I am getting the following error.
index.js:1452 Warning: Each child in an array or iterator should have a unique "key" prop.

But have I not included that in the map function?  Any help would be appreciated.
Below is the code for my memberstore.
import {observable, action, computed} from 'mobx';

class MemberStore {
@observable members = [];

@action addMember({name, email}) {
    const existing = this.members;
    this.members = existing.concat({name,email});
}

@computed get memberCount() {
    return this.members.length;
 }

}
const store = new MemberStore();
export default store;


This is a possible duplicate question. You may want to look at this https://stackoverflow.com/questions/28329382/understanding-unique-keys-for-array-children-in-react-js/43892905#43892905

Are you sure it's referring to that code because that works ok (you'd get a slightly differerent error if member weren't all unique). Are you using map anywhere else?

Your members array store items that have two properties: name and email.
In your map function you are using destructuring ({member, email}). There's no member property in the members item. Change member to name (and make sure that each item has unique value for name property if you want to use it as a key). 
  <ul>
    {MemberStore.members.map(({ name, email }, i) => (
      <li key={i}>
        {name}
        {email}
      </li>
    ))}
  </ul>


I have done this to the a map function <ul>                     {MemberStore.members.map(({name, email},member) => (                         <li key={member}>                             {name}                             {email}                         </li>                     ))}                     </ul>

@AltBrian try replacing your code with the code I've just added to the answer.

I don't know what is coming in member, it should be the same for ever iterated line, so try it: 
<ul>
  {MemberStore.members.map(({member, email}, index) => (
     <li key={index}>
        {member}
        {email}
     </li>
  ))}
</ul>


Unfortunately, it is still not working JmLavoier. It gives me an empty array.
