diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-01-13 17:03:51 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-01-13 17:03:51 +0700 |
| commit | b517722a1d370cbd7457cf98866b806832d61680 (patch) | |
| tree | 907fedb193ece168f84cdc046c3fb9490406fe4c /src/components/SelectFormik.js | |
| parent | 99c4d78b198d6baaded5b96a604525feb1b099ba (diff) | |
Formik and yup implement
Diffstat (limited to 'src/components/SelectFormik.js')
| -rw-r--r-- | src/components/SelectFormik.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/components/SelectFormik.js b/src/components/SelectFormik.js new file mode 100644 index 00000000..4fd711c5 --- /dev/null +++ b/src/components/SelectFormik.js @@ -0,0 +1,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;
\ No newline at end of file |
