Skip to content

CreatableSelect with onCreateOption prop has a bug #112

Answered by csandman
t6adev asked this question in Q&A
Discussion options

You must be logged in to vote

So if you look at the documentation for that prop, this is what it says:

onCreateOption


If provided, this will be called with the input value when a new option is created, and onChange will not be called. Use this when you need more control over what happens when new options are created.

(inputValue:string) => void

https://react-select.com/props#creatable-props

So this means that if you use this option, you will have to implement some manual code for setting the option. If you look at the code in the example you provided for the original package, you'll see that in their onCreateOption function they're handling how the new value is being set on the select.

I made a modified version o…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by csandman
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Bug Something isn't working Not Really a Bug Someone thought it was a bug, but turns out its not a bug
2 participants
Converted from issue

This discussion was converted from issue #46 on May 05, 2022 19:39.