summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Select/HookFormSelect.jsx
blob: 055a9c68922b28bf5fa52dbdb75aa105cddce409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import ReactSelect from 'react-select'

const HookFormSelect = ({ field, ...props }) => (
  <ReactSelect
    classNamePrefix='form-select'
    ref={field.ref}
    onChange={(option) => field.onChange(option.value)}
    value={field.value ? props.options.find((option) => option.value === field.value) : ''}
    isDisabled={props.disabled}
    {...props}
  />
)

export default HookFormSelect