Created
October 17, 2017 18:30
-
-
Save johhansantana/b16640940ed91b7d606c2186bd189d6f to your computer and use it in GitHub Desktop.
react-select multiple select input with redux-form example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)} | |
/> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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