i'm entirely lost when it comes to figuring this out. I have a existing select that works with formik & react-select, but I can't get it to work as a multi. Here's what i have so far:
import Select from 'react-select'; import { useField } from 'formik'; export default function SelectField(props) { const [field, state, { setValue, setTouched }] = useField(props.field.name); const onChange = ({ value }) => { setValue(value); }; return <Select {...props} onChange={onChange} onBlur={setTouched} />; }
and
<Field component={SelectField} name="campfeatures" options={selectObjects} />
How would I turn this into being capable of taking multi select? If I add isMulti to the Field, it "works" but it doesn't actually retain the multiple values.
Thanks for your help!
https://stackoverflow.com/questions/66539650/formik-react-select-multiple-variables March 09, 2021 at 09:45AM
没有评论:
发表评论