React multi-select-like component with filter
Overall this is good, but there are few things we can do improve this and make it more "modular".

Lets say someone wants to use your component and instead of an array of player objects, they have just an array of player names, this introduces a couple of problems.


The prop to pass this in the list is called objects which doesn't reflect the type of data that they have and their list is long so they can't manually change it.
Your component is expecting the data passed in objects to be an array of objects.


How can we resolve this?

Lets first rename the prop from objects -&gt; data, this is better because it generalizes what this prop receives and the person using this can possibly assume you are able to handle multiple data types.

Next, we should update places where we are assuming the data to be an object and instead check to see if it is an object before handling it. One example is in &lt;MultiSelect /&gt;, where you are iterating over each item. We can change that to be:

class MultiSelect extends React.Component {
  render() {
    return (
      &lt;ul&gt;
        {this.props.data.map((item, index) =&gt; (
          &lt;li onClick={() =&gt; this.props.onClickFunction(index)}&gt;
            {typeof item === "object" ? item.name : item}
          &lt;/li&gt;
        ))}
      &lt;/ul&gt;
    );
  }
}


Now we can display data from an array of strings!

But what if the person using your component was using an array of objects? Unfortunately there is no documentation so when he created the objects he used the property name firstName instead of name. This now breaks the code we re-wrote above, but we can fix it...

Lets set a new prop on &lt;DoubleMultiselect /&gt; called something like nameField, which would be a string that is equal to the object property to display in the list.

So now wherever we were accessing the name property of the player we can replace it with this.props.nameField, re-writing the code above can now be:

class MultiSelect extends React.Component {
  render() {
    return (
      &lt;ul&gt;
        {this.props.data.map((item, index) =&gt; (
          &lt;li onClick={() =&gt; this.props.onClickFunction(index)}&gt;
            {typeof item === "object" ? item[this.props.nameField]: item}
          &lt;/li&gt;
        ))}
      &lt;/ul&gt;
    );
  }
}


We've now added support for dynamic data, allowing anyone with any type of data to use this!