const ReactRedux = require('react-redux'); const actions = require('./actions'); const React = require('react'); const axios = require('axios'); const users = require('../../users'); var ReactSelectize = require("react-selectize"); var MultiSelect = ReactSelectize.MultiSelect; const { connect } = ReactRedux; const { fetch } = actions; const mapStateToProps = (state) => { return state; }; const mapDispatchToProps = (dispatch, ownProps) => { return { fetch: () => { return dispatch(fetch()); } } }; const SearchMulti = React.createClass({ getInitialState: function(){ return { countries: [], country: undefined }; }, componentWillMount: function(){ var self = this; this.req = axios.get("http://restverse.com/countries").then(function(countries){ self.setState({countries: countries.data}, function(){ self.refs.select.highlightFirstSelectableOption(); }); }); }, render: function(){ var self = this; const _onValueChange = (country) => { self.setState({country: country}); } const _renderNoResultsFound = () => { return (
{!!self.req ? "loading countries ..." : "No results found"}
) } return (

Multiple Options

{ !!self.state.country ? (
you selected: {self.state.country.label}
) : null }
) } }) module.exports = connect( mapStateToProps, mapDispatchToProps, )(SearchMulti);