Skip to content

Instantly share code, notes, and snippets.

@johhansantana
Created October 17, 2017 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johhansantana/b16640940ed91b7d606c2186bd189d6f to your computer and use it in GitHub Desktop.
Save johhansantana/b16640940ed91b7d606c2186bd189d6f to your computer and use it in GitHub Desktop.
react-select multiple select input with redux-form example
const renderSelect = field => (
<Select
id={field.id}
name={field.input.name}
multi={true}
joinValues={true}
value={field.input.value}
options={field.options}
onChange={(val) => field.input.onChange(val)}
/>
)
const categories = [
{ label: 'Banana', value: '1' },
{ label: 'Apple', value: '2' },
{ label: 'Mango', value: '3' },
{ label: 'Goa', value: '4' },
{ label: 'Grapes', value: '5' },
{ label: 'Pine Apple', value: '6' },
];
<Field
name={'categories'}
id={'categories'}
component={renderSelect}
options={categories}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment