title: Get react-select selected option when using multi dropdown
body: <p>I have two working <a href="https://github.com/JedWatson/react-select/" rel="noreferrer">react-select</a> drop downs on my page, one that allows the user to select A or B, and one that allows them to choose multiple items from &quot;blue, yellow , red&quot;.</p>
  <p>When they have chosen these items, I want to use them. For now I just want to check the values that have been selected, so I'm just printing them to screen. For the single selection drop down I have used the example code from the github successfully. This is as follows:</p>
  <pre><code>import React from 'react';
  import Select from 'react-select';
  
  const options = [
    { value: 'a', label: 'a' },
    { value: 'b', label: 'b' },
  ];
  
  class App extends React.Component {
    state = {
      selectedOption: null,
    }
    handleChange = (selectedOption) =&gt; {
      this.setState({ selectedOption });
      document.write(`Option selected:`, selectedOption.value); //this prints the selected option
    }
    render() {
      const { selectedOption } = this.state;
  
      return (
        &lt;Select
          value={selectedOption}
          onChange={this.handleChange}
          options={options}
          //isMulti //added when the user can pick more than one
        /&gt;
      );
    }
  }
  </code></pre>
  <p>My question is how do I successfully do this for the multi option? The user can select as many as they wish, but an 'undefined' error is thrown when it prints the option that has been selected. I think this is because the option is stored in an array but I'm not sure.</p>
  <p>Thanks all.</p>