- 
  Notifications
 
You must be signed in to change notification settings  - Fork 19
 
Bind ManagedFormInput props to input props #40
Bind ManagedFormInput props to input props #40
Conversation
Hello, thanks for the kind words and the PR!
The FormInput component in Framework7 React (which ends up rendering a ManagedFormInput) is designed to work as a controlled form component. defaultValue is only meant for uncontrolled components as far as I know--you set the default value and and then updates to the element don't affect state and are read by accessing the DOM element (e.g., via refs). Additionally, defaultValue is not a supported prop on the FormInput component, so there is no way that defaultValue should be getting passed into the ManagedFormInput component.
The preferred way to set an initial value in Framework7 React is by setting the value prop on the initial render and provide an onChange handler, as shown in the kitchen sink. The combination of setting the value prop and providing an onChange makes it a controlled component.
Alternatively, if you strongly prefer to use an unmanaged input component, you can certainly render your own input element instead of F7 React's FormInput component.
Or perhaps I am misunderstanding something?
Hi @bencompton, you are completely right, I certainly used this wrong, the first time I tried, and I was not binding the value correctly, but thanks for the explanation and sorry to bother!
Hi! At first good job with this library :)
I wanted to bind
defaultValuevalue to input and I couldn't, that's why I'm doing this fix :)I hope that this can be merged 👍