Problems with implementing React Select in the database #787
-
Hi! For the tags in our form we implemented react-select, a library to be able to select multiple options and create new tags. At first, everything works just like we need it. But I have a problem with implementing the connection to the database. Here is the link to the pull request. data.tags returns undefined. In the CreateSelect component onCreateOptions makes sure that the new entered Value appears in the input field. How do I get the new tags to the database? I thought it should work like the link-array of objects, but we're a little bit stuck. We appreciate any ideas. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
First thing I noticed is, that you are not setting the state you want to use anywhere:
I dont know the library you are using yet, but it is possible that the tags work as expected, but you are not receiving them in your state yet |
Beta Was this translation helpful? Give feedback.
-
I came up with a small prototype that shows how to handle this use-case in an isolated way, maybe this can help you already: https://codesandbox.io/s/creatable-prototype-mxsvrt?file=/src/App.js |
Beta Was this translation helpful? Give feedback.
-
Fixed this morning by the magical presence of @ Roland. |
Beta Was this translation helpful? Give feedback.
Fixed this morning by the magical presence of @ Roland.