React-select: AsyncCreatableSelect does not show values with Formik

Created on 8 Dec 2020  路  8Comments  路  Source: JedWatson/react-select

I am using Formik, and I have checked with behaves differently is because I have checked this issue(https://stackoverflow.com/questions/58502707/react-select-with-formik-not-updating-select-field-but-does-everything-else) and the sandbox for it is https://codesandbox.io/s/react-select-formik-jet92?file=/src/Form.jsx.

In this example, they are not using from Formik which makes it behaves differently and can use setFieldValue("fieldname", opt.value) and the clear works fine. I did not notice they are not using .

Then I made an updated sandbox of mine:

  1. Without Field: https://codesandbox.io/s/formik-asynccreatableselect-3-h3t1o?file=/TestComponent.js
  2. With Field: https://codesandbox.io/s/formik-asynccreatableselect-1-cte9o?file=/TestComponent.js

...................

Though I have no idea why using a Field or not makes this difference... 馃 But it's a kinda ugly workaround for myself.

Thanks!

Sorry again my markdown is still not working... 馃槬

I'm trying to use a screenshot so that you can see it better.

Seems my image cannot be updated as well....

Capture

Recopying @flora8984461 's reply to get better Markup support:

Thank you so much for your help. I had another deep look into this, and I found:

I thought behaves differently is because I have checked this issue and the sandbox for it.

In this example, they are not using from Formik which makes it behaves differently and can use
setFieldValue("fieldname", opt.value) and the clear works fine. I did not notice they are not using .

Then I made an updated sandbox of mine:

  1. Without Field: https://codesandbox.io/s/formik-asynccreatableselect-3-h3t1o?file=/TestComponent.js
  2. With Field: https://codesandbox.io/s/formik-asynccreatableselect-1-cte9o?file=/TestComponent.js

Though I have no idea why using a Field or not makes this difference... 馃 But it's a kinda ugly workaround for myself. Thanks! Sorry again my markdown is still not working... 馃槬 I'm trying to use a screenshot so that you can see it better. Seems my image cannot be updated as well....

@flora8984461 Your examples seem fine from what I can tell.I do not have a lot of experience with Formik so not sure if I am missing something.

Is there something missing or wrong with either implementation that you are asking for help with?

@flora8984461 Your examples seem fine from what I can tell.I do not have a lot of experience with Formik so not sure if I am missing something.

Is there something missing or wrong with either implementation that you are asking for help with?

Thank you so much.

Yeah I think I kinda fixed it. Just put my code sandbox here in case someone else comes into the similar issue or has a better workaround on this.

Awesome! Glad you got everything working!

Was this page helpful?
0 / 5 - 0 ratings