Use Fable.React.Helpers.valueOrDefault
instead of DefaultValue
or Value
:
/// `Ref` callback that sets the value of an input textbox after DOM element is created.// Can be used instead of `DefaultValue` and `Value` props to override input box value.let inline valueOrDefault value = Ref <| (fun e -> if e |> isNull |> not && !!e?value <> !!value then e?value <- !!value)
Maximillian points out in his answer that it's because React is recreating the DOM object. In my attempt to figure out how to use hooks to determine why, I ended up learning about React Hooks and about how to use them from Fable, but I never figured out how to use them to figure out what's causing the DOM object to be deleted.