summaryrefslogtreecommitdiff
path: root/src/components/SelectFormik.js
blob: 4fd711c52eba1353978932aa8a00ddcaa27f9ee6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import ReactSelect from "react-select";

const SelectFormik = ({
  options,
  field,
  form
}) => {
  return <ReactSelect
    options={options}
    name={field.name}
    value={options ? options.find(option => option.value === field.value) : ''}
    onChange={(option) => form.setFieldValue(field.name, option.value)}
    onBlur={field.onBlur}
    classNamePrefix={field}
  />
}

export default SelectFormik;