Code Monkey home page Code Monkey logo

Comments (3)

csandman avatar csandman commented on May 27, 2024

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 of the chakra-react-select demo you made implementing all of the code from the original example, and it works in the same way: https://codesandbox.io/s/chakra-react-select-oncreateoption-forked-q7703?file=/app.tsx

Let me know if this solves your issue!

from chakra-react-select.

t6adev avatar t6adev commented on May 27, 2024

Oh, So sorry for bothering you, it's my fault.
I didn't confirm the doc and my shared code carefully.

I also re-implemented my sample code then it works well.
https://codesandbox.io/s/chakra-react-select-oncreateoption-cy2ko?file=/app.tsx

Thank you so much for taking your time.

from chakra-react-select.

csandman avatar csandman commented on May 27, 2024

No worries, glad I could help!

from chakra-react-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.