Open Noitidart opened 7 years ago
You want the defaultValue to be null?
Thanks so much @dubert for the reply. Yes sir, it should be blank, and then when they pick something it should not change state, just set uncontrolled value of the input box via a ref or document.blah.value = 'rawr'. The important thing is, uncontrolled components do not get their uncontrolled value wiped out on re-render. When user clicks "submit" on my form I re-render my form to show a loading animation, at that point the Kronos field gets wiped out.
Basically I had expected an uncontrolled <Kronos defaultDate="blah">
should behave just like an uncontorlled <Input type="text" defaultValue="blah">
.
Looks like you're correct. The uncontrolled is not truly uncontrolled. I'm not entirely sure how to implement this though, since there is a lot of internal logic handling the validation of the date and internal state storage. Do you have any recommendations?
I've read Facebook's page on uncontrolled components but it doesn't help me implement them.
Thanks @dubert!
I haven't looked into the internals yet :( I will try to take a peak
Is it really possible to do uncontrolled? In the demo it's connected to state. I need a totally uncontrolled field with just a defaultValue. In all cases I need defaultValue to be blank. Right now on re-render it is blanking out, or if I set a
date
prop it goes back to that original value.