react-debounce-input
react-debounce-input copied to clipboard
Value doesn't clear if undefined
If the value prop is bound using an undefined value then it appears that when the component is rendered it remembers the old value. Is this by design?
Probably related to #40
If you pass undefined
to the value
prop, then component becomes uncontrolled
and React will give a warning about it. Not sure if this needs to be fixed... Tho I have a PR to let it work as uncontrolled component #33, currently it does not make much sense to have onChange
and pass value={undefined}
, that would def trigger warning.
I was binding value={store.someVar}
, which starts as undefined
like an "empty" value. I can then onChange={e => dispatchSetSomeVar(e)}
to set the someVar
in the store via reducer.
When you try this with the current version, the store updates but what's displayed in the control doesn't.
HTH!