Closed deodad closed 4 years ago
This was fixed in v1.0.4, you can now pass a function that is called on change:
useSelect({
...
onChange: console.log,
});
The selected value is also available in the snapshot returned by the hook. So you could use the useEffect
hook to run code when that changes. Like this:
useEffect(() => {
// value changed
}, [snapshot.value]);
Thanks for the great library.
I'm running into an issue using the
useSelect
hook where I'm unable to provide anonChange
function for the when the value changes. I tried passing it intouseSelect
but I see it's not a supported option.Is this something that can be added or is there another preferred way to fire a function after a change in headless mode?