pmndrs / leva

🌋 React-first components GUI

Home Page:https://leva.pmnd.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Controlled value is undefined when adding an "onChange" callback to a "dropdown" option

bgirschig opened this issue · comments

Hello!
I'm experiencing an issue with a dropdown control when I try to add a callback to it:

const { dogFood } = useControls({
  dogFood: {
    options: {
      "meat": "yay",
      "chocolate": "nay",
    },
    onChange: console.log,
  },
  something: True,
});

// "dogFood" is undefined

The callback is called at the correct time, but the value is not usable.

typescript compilation fails with the following error:

Property dogFood does not exist on type { something: boolean; }"

leva: 0.9.35
tsc: 5.4.5

By the way, thanks for the lib! It's really pretty and helpful.